using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using C1.Win.C1Input;
using C1.Win.C1TrueDBGrid;

//Using PCS's namespaces
using PCSComProcurement.Purchase.BO;
using PCSComProcurement.Purchase.DS;
using PCSComUtils.Common;
using PCSComUtils.Common.BO;
using PCSComUtils.MasterSetup.DS;
using PCSComUtils.Framework.ReportFrame.BO;
using PCSComUtils.PCSExc;
using PCSUtils.Log;
using PCSUtils.Utils;
using PCSUtils.Framework.ReportFrame;
using PCSComUtils.DataContext;
using System.Collections.Generic;

namespace PCSProcurement.Purchase
{
	/// <summary>
	/// Summary description for POInvoice.
	/// </summary>
	public class POInvoice : System.Windows.Forms.Form
	{
		#region Declaration
		
		#region Generated Declaration
		
		private C1.Win.C1Input.C1NumericEdit numValue;
		private C1.Win.C1Input.C1NumericEdit numTotalVatAmount;
		private C1.Win.C1Input.C1NumericEdit numTotalBeforeVAT;
		private C1.Win.C1Input.C1NumericEdit numTotalImpTax;
		private C1.Win.C1Input.C1NumericEdit numTotalCIFAmount;
		private System.Windows.Forms.Button btnInvoiceNo;
		private System.Windows.Forms.TextBox txtInvoiceNo;
		private C1.Win.C1Input.C1NumericEdit numExchRate;
		private C1.Win.C1Input.C1DateEdit dtmPostDate;
		private System.Windows.Forms.TextBox txtBLNo;
		private C1.Win.C1Input.C1DateEdit dtmBLDate;
		private System.Windows.Forms.TextBox txtTaxInformNo;
		private System.Windows.Forms.TextBox txtDeclaredNo;
		private C1.Win.C1Input.C1DateEdit dtmInformDate;
		private C1.Win.C1Input.C1DateEdit dtmDeclareDate;
		private System.Windows.Forms.TextBox txtCurrency;
		private System.Windows.Forms.TextBox txtCarrier;
		private System.Windows.Forms.TextBox txtPayTerms;
		private System.Windows.Forms.TextBox txtDeliveryTerms;
		private System.Windows.Forms.TextBox txtVendor;
		private System.Windows.Forms.TextBox txtVendorName;
		private System.Windows.Forms.Button btnVendorName;
		private System.Windows.Forms.Button btnCurrency;
		private System.Windows.Forms.Button btnCarrier;
		private System.Windows.Forms.Button btnPayTerms;
		private System.Windows.Forms.Button btnDeliveryTerms;
		private System.Windows.Forms.Label lblTotalImpTax;
		private System.Windows.Forms.Label lblTotalDiscount;
		private System.Windows.Forms.Label lblSpecTax;
		private System.Windows.Forms.Label lblTotalVAT;
		private System.Windows.Forms.Button btnEdit;
		private System.Windows.Forms.Button btnClose;
		private System.Windows.Forms.Button btnHelp;
		private System.Windows.Forms.Button btnDelete;
		private System.Windows.Forms.Button btnSave;
		private System.Windows.Forms.Button btnAdd;
		private System.Windows.Forms.Button btnPrint;
		private System.Windows.Forms.Button btnVendor;
		private C1.Win.C1List.C1Combo cboCCN;
		private System.Windows.Forms.Label lblCCN;
		private System.Windows.Forms.Label lblExchRate;
		private System.Windows.Forms.Label lblCurrency;
		private System.Windows.Forms.Label lblVendor;
		private System.Windows.Forms.Label lblOrderDate;
		private System.Windows.Forms.Label lblPayTerms;
		private System.Windows.Forms.Label lblDeliveryTerms;
		private System.Windows.Forms.Label lblCarrier;
		private System.Windows.Forms.Label lblBLDate;
		private System.Windows.Forms.Label lblInformDate;
		private System.Windows.Forms.Label lblTaxInformNo;
		private System.Windows.Forms.Label lblTaxDeclareNo;
		private System.Windows.Forms.Label lblDeclareDate;
		private System.Windows.Forms.Label lblBLNo;
		private C1.Win.C1Input.C1NumericEdit numTotalInlandAmt;
		private System.Windows.Forms.Label lblTotalCIPAmt;
		private System.Windows.Forms.Label lblTotalInlandAmt;
		private C1.Win.C1Input.C1NumericEdit numTotalCIPAmt;
		private C1.Win.C1TrueDBGrid.C1TrueDBGrid dgrdData;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;
		
		#endregion Generated Declaration
		
		#region Constants
		
		private const string THIS = "PCSProcurement.Purchase.POInvoice";
		private const string ZERO_STRING = "0";
		private const string DETAILED_INVOICE_MASTER_VIEW = "v_DetailedPOInvoiceMaster";
		private const string PERCENT_VALUE_RANGE = "(0, 100]";
		private const string VENDOR_CUSTOMER_VIEW = "V_VendorCustomer";
		private const string VENDOR_COLUMN = "Vendor";		

		#endregion Constants
		
		private EnumAction enuFormAction = EnumAction.Default;
		private bool blnDataIsValid = false;		
		private DataTable dtbGridLayOut;
		private DataTable dtbDetail;
		private PO_InvoiceMasterVO voMaster;
		private int intCurrentRow = 0;
		private ValueItemCollection vQAStatus;
		private System.Windows.Forms.Label lblInputTotalInland;
		private System.Windows.Forms.Label lblInvoiceNo;
		private System.Windows.Forms.Label lblPOApprovalDate;
		private System.Windows.Forms.Button btnPrintConfiguration;
		private System.Windows.Forms.Label lblVATTaxRate;
		private System.Windows.Forms.Label lblImportTaxRate;
		private C1.Win.C1Input.C1NumericEdit numQuantity;
		private System.Windows.Forms.Button btnCheckQA;

		
		private POInvoiceBO boMaster = new POInvoiceBO();

		#endregion Declaration

		#region Constructor, Destructor
		public POInvoice()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}
		
		#endregion Constructor, Destructor

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(POInvoice));
            C1.Win.C1TrueDBGrid.Style style1 = new C1.Win.C1TrueDBGrid.Style();
            C1.Win.C1TrueDBGrid.Style style2 = new C1.Win.C1TrueDBGrid.Style();
            C1.Win.C1TrueDBGrid.Style style3 = new C1.Win.C1TrueDBGrid.Style();
            C1.Win.C1TrueDBGrid.Style style4 = new C1.Win.C1TrueDBGrid.Style();
            C1.Win.C1TrueDBGrid.Style style5 = new C1.Win.C1TrueDBGrid.Style();
            C1.Win.C1TrueDBGrid.Style style6 = new C1.Win.C1TrueDBGrid.Style();
            C1.Win.C1TrueDBGrid.Style style7 = new C1.Win.C1TrueDBGrid.Style();
            C1.Win.C1TrueDBGrid.Style style8 = new C1.Win.C1TrueDBGrid.Style();
            C1.Win.C1TrueDBGrid.Style style9 = new C1.Win.C1TrueDBGrid.Style();
            C1.Win.C1TrueDBGrid.Style style10 = new C1.Win.C1TrueDBGrid.Style();
            C1.Win.C1TrueDBGrid.Style style11 = new C1.Win.C1TrueDBGrid.Style();
            C1.Win.C1TrueDBGrid.Style style12 = new C1.Win.C1TrueDBGrid.Style();
            C1.Win.C1TrueDBGrid.Style style13 = new C1.Win.C1TrueDBGrid.Style();
            C1.Win.C1List.Style style14 = new C1.Win.C1List.Style();
            C1.Win.C1List.Style style15 = new C1.Win.C1List.Style();
            C1.Win.C1List.Style style16 = new C1.Win.C1List.Style();
            C1.Win.C1List.Style style17 = new C1.Win.C1List.Style();
            C1.Win.C1List.Style style18 = new C1.Win.C1List.Style();
            C1.Win.C1List.Style style19 = new C1.Win.C1List.Style();
            C1.Win.C1List.Style style20 = new C1.Win.C1List.Style();
            C1.Win.C1List.Style style21 = new C1.Win.C1List.Style();
            this.txtCurrency = new System.Windows.Forms.TextBox();
            this.txtCarrier = new System.Windows.Forms.TextBox();
            this.txtPayTerms = new System.Windows.Forms.TextBox();
            this.txtDeliveryTerms = new System.Windows.Forms.TextBox();
            this.dgrdData = new C1.Win.C1TrueDBGrid.C1TrueDBGrid();
            this.txtInvoiceNo = new System.Windows.Forms.TextBox();
            this.txtVendor = new System.Windows.Forms.TextBox();
            this.txtVendorName = new System.Windows.Forms.TextBox();
            this.numTotalVatAmount = new C1.Win.C1Input.C1NumericEdit();
            this.numTotalBeforeVAT = new C1.Win.C1Input.C1NumericEdit();
            this.numTotalImpTax = new C1.Win.C1Input.C1NumericEdit();
            this.numTotalCIFAmount = new C1.Win.C1Input.C1NumericEdit();
            this.btnVendorName = new System.Windows.Forms.Button();
            this.numExchRate = new C1.Win.C1Input.C1NumericEdit();
            this.dtmPostDate = new C1.Win.C1Input.C1DateEdit();
            this.btnCurrency = new System.Windows.Forms.Button();
            this.btnCarrier = new System.Windows.Forms.Button();
            this.btnPayTerms = new System.Windows.Forms.Button();
            this.btnDeliveryTerms = new System.Windows.Forms.Button();
            this.lblTotalImpTax = new System.Windows.Forms.Label();
            this.lblTotalDiscount = new System.Windows.Forms.Label();
            this.lblSpecTax = new System.Windows.Forms.Label();
            this.lblTotalVAT = new System.Windows.Forms.Label();
            this.btnEdit = new System.Windows.Forms.Button();
            this.btnClose = new System.Windows.Forms.Button();
            this.btnHelp = new System.Windows.Forms.Button();
            this.btnDelete = new System.Windows.Forms.Button();
            this.btnSave = new System.Windows.Forms.Button();
            this.btnAdd = new System.Windows.Forms.Button();
            this.btnPrint = new System.Windows.Forms.Button();
            this.btnInvoiceNo = new System.Windows.Forms.Button();
            this.btnVendor = new System.Windows.Forms.Button();
            this.cboCCN = new C1.Win.C1List.C1Combo();
            this.lblCCN = new System.Windows.Forms.Label();
            this.lblExchRate = new System.Windows.Forms.Label();
            this.lblCurrency = new System.Windows.Forms.Label();
            this.lblVendor = new System.Windows.Forms.Label();
            this.lblInvoiceNo = new System.Windows.Forms.Label();
            this.lblOrderDate = new System.Windows.Forms.Label();
            this.lblPayTerms = new System.Windows.Forms.Label();
            this.lblDeliveryTerms = new System.Windows.Forms.Label();
            this.lblCarrier = new System.Windows.Forms.Label();
            this.dtmBLDate = new C1.Win.C1Input.C1DateEdit();
            this.lblBLDate = new System.Windows.Forms.Label();
            this.txtTaxInformNo = new System.Windows.Forms.TextBox();
            this.lblTaxInformNo = new System.Windows.Forms.Label();
            this.txtDeclaredNo = new System.Windows.Forms.TextBox();
            this.lblTaxDeclareNo = new System.Windows.Forms.Label();
            this.dtmInformDate = new C1.Win.C1Input.C1DateEdit();
            this.lblInformDate = new System.Windows.Forms.Label();
            this.dtmDeclareDate = new C1.Win.C1Input.C1DateEdit();
            this.lblDeclareDate = new System.Windows.Forms.Label();
            this.numTotalCIPAmt = new C1.Win.C1Input.C1NumericEdit();
            this.numTotalInlandAmt = new C1.Win.C1Input.C1NumericEdit();
            this.lblTotalCIPAmt = new System.Windows.Forms.Label();
            this.lblTotalInlandAmt = new System.Windows.Forms.Label();
            this.txtBLNo = new System.Windows.Forms.TextBox();
            this.lblBLNo = new System.Windows.Forms.Label();
            this.numValue = new C1.Win.C1Input.C1NumericEdit();
            this.lblInputTotalInland = new System.Windows.Forms.Label();
            this.lblPOApprovalDate = new System.Windows.Forms.Label();
            this.btnPrintConfiguration = new System.Windows.Forms.Button();
            this.lblVATTaxRate = new System.Windows.Forms.Label();
            this.lblImportTaxRate = new System.Windows.Forms.Label();
            this.numQuantity = new C1.Win.C1Input.C1NumericEdit();
            this.btnCheckQA = new System.Windows.Forms.Button();
            ((System.ComponentModel.ISupportInitialize)(this.dgrdData)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.numTotalVatAmount)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.numTotalBeforeVAT)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.numTotalImpTax)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.numTotalCIFAmount)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.numExchRate)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.dtmPostDate)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.cboCCN)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.dtmBLDate)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.dtmInformDate)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.dtmDeclareDate)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.numTotalCIPAmt)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.numTotalInlandAmt)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.numValue)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.numQuantity)).BeginInit();
            this.SuspendLayout();
            // 
            // txtCurrency
            // 
            this.txtCurrency.AccessibleDescription = null;
            this.txtCurrency.AccessibleName = null;
            resources.ApplyResources(this.txtCurrency, "txtCurrency");
            this.txtCurrency.BackgroundImage = null;
            this.txtCurrency.Font = null;
            this.txtCurrency.Name = "txtCurrency";
            this.txtCurrency.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtCurrency_KeyDown);
            this.txtCurrency.Validating += new System.ComponentModel.CancelEventHandler(this.txtCurrency_Validating);
            // 
            // txtCarrier
            // 
            this.txtCarrier.AccessibleDescription = null;
            this.txtCarrier.AccessibleName = null;
            resources.ApplyResources(this.txtCarrier, "txtCarrier");
            this.txtCarrier.BackgroundImage = null;
            this.txtCarrier.Font = null;
            this.txtCarrier.Name = "txtCarrier";
            this.txtCarrier.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtCarrier_KeyDown);
            this.txtCarrier.Validating += new System.ComponentModel.CancelEventHandler(this.txtCarrier_Validating);
            // 
            // txtPayTerms
            // 
            this.txtPayTerms.AccessibleDescription = null;
            this.txtPayTerms.AccessibleName = null;
            resources.ApplyResources(this.txtPayTerms, "txtPayTerms");
            this.txtPayTerms.BackgroundImage = null;
            this.txtPayTerms.Font = null;
            this.txtPayTerms.Name = "txtPayTerms";
            this.txtPayTerms.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtPayTerms_KeyDown);
            this.txtPayTerms.Validating += new System.ComponentModel.CancelEventHandler(this.txtPayTerms_Validating);
            // 
            // txtDeliveryTerms
            // 
            this.txtDeliveryTerms.AccessibleDescription = null;
            this.txtDeliveryTerms.AccessibleName = null;
            resources.ApplyResources(this.txtDeliveryTerms, "txtDeliveryTerms");
            this.txtDeliveryTerms.BackgroundImage = null;
            this.txtDeliveryTerms.Font = null;
            this.txtDeliveryTerms.Name = "txtDeliveryTerms";
            this.txtDeliveryTerms.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtDeliveryTerms_KeyDown);
            this.txtDeliveryTerms.Validating += new System.ComponentModel.CancelEventHandler(this.txtDeliveryTerms_Validating);
            // 
            // dgrdData
            // 
            this.dgrdData.AccessibleDescription = null;
            this.dgrdData.AccessibleName = null;
            resources.ApplyResources(this.dgrdData, "dgrdData");
            this.dgrdData.BackgroundImage = null;
            this.dgrdData.CaptionStyle = style1;
            this.dgrdData.ChildGrid = null;
            this.dgrdData.EditorStyle = style2;
            this.dgrdData.EvenRowStyle = style3;
            this.dgrdData.FilterBarStyle = style4;
            this.dgrdData.Font = null;
            this.dgrdData.FooterStyle = style5;
            this.dgrdData.GroupStyle = style6;
            this.dgrdData.HeadingStyle = style7;
            this.dgrdData.HighLightRowStyle = style8;
            this.dgrdData.Images.Add(((System.Drawing.Image)(resources.GetObject("dgrdData.Images"))));
            this.dgrdData.InactiveStyle = style9;
            this.dgrdData.MarqueeStyle = C1.Win.C1TrueDBGrid.MarqueeEnum.DottedCellBorder;
            this.dgrdData.Name = "dgrdData";
            this.dgrdData.OddRowStyle = style10;
            this.dgrdData.PictureAddnewRow = null;
            this.dgrdData.PictureCurrentRow = null;
            this.dgrdData.PictureFilterBar = null;
            this.dgrdData.PictureFooterRow = null;
            this.dgrdData.PictureHeaderRow = null;
            this.dgrdData.PictureModifiedRow = null;
            this.dgrdData.PictureStandardRow = null;
            this.dgrdData.PreviewInfo.AllowSizing = ((bool)(resources.GetObject("dgrdData.PreviewInfo.AllowSizing")));
            this.dgrdData.PreviewInfo.Caption = resources.GetString("dgrdData.PreviewInfo.Caption");
            this.dgrdData.PreviewInfo.Location = ((System.Drawing.Point)(resources.GetObject("dgrdData.PreviewInfo.Location")));
            this.dgrdData.PreviewInfo.Size = ((System.Drawing.Size)(resources.GetObject("dgrdData.PreviewInfo.Size")));
            this.dgrdData.PreviewInfo.ToolBars = ((bool)(resources.GetObject("dgrdData.PreviewInfo.ToolBars")));
            this.dgrdData.PreviewInfo.UIStrings.Content = ((string[])(resources.GetObject("dgrdData.PreviewInfo.UIStrings.Content")));
            this.dgrdData.PreviewInfo.ZoomFactor = ((double)(resources.GetObject("dgrdData.PreviewInfo.ZoomFactor")));
            this.dgrdData.PrintInfo.MaxRowHeight = ((int)(resources.GetObject("dgrdData.PrintInfo.MaxRowHeight")));
            this.dgrdData.PrintInfo.OwnerDrawPageFooter = ((bool)(resources.GetObject("dgrdData.PrintInfo.OwnerDrawPageFooter")));
            this.dgrdData.PrintInfo.OwnerDrawPageHeader = ((bool)(resources.GetObject("dgrdData.PrintInfo.OwnerDrawPageHeader")));
            this.dgrdData.PrintInfo.PageFooter = resources.GetString("dgrdData.PrintInfo.PageFooter");
            this.dgrdData.PrintInfo.PageFooterHeight = ((int)(resources.GetObject("dgrdData.PrintInfo.PageFooterHeight")));
            this.dgrdData.PrintInfo.PageHeader = resources.GetString("dgrdData.PrintInfo.PageHeader");
            this.dgrdData.PrintInfo.PageHeaderHeight = ((int)(resources.GetObject("dgrdData.PrintInfo.PageHeaderHeight")));
            this.dgrdData.PrintInfo.PageSettings = ((System.Drawing.Printing.PageSettings)(resources.GetObject("dgrdData.PrintInfo.PageSettings")));
            this.dgrdData.PrintInfo.PrintHorizontalSplits = ((bool)(resources.GetObject("dgrdData.PrintInfo.PrintHorizontalSplits")));
            this.dgrdData.PrintInfo.ProgressCaption = resources.GetString("dgrdData.PrintInfo.ProgressCaption");
            this.dgrdData.PrintInfo.RepeatColumnFooters = ((bool)(resources.GetObject("dgrdData.PrintInfo.RepeatColumnFooters")));
            this.dgrdData.PrintInfo.RepeatColumnHeaders = ((bool)(resources.GetObject("dgrdData.PrintInfo.RepeatColumnHeaders")));
            this.dgrdData.PrintInfo.RepeatGridHeader = ((bool)(resources.GetObject("dgrdData.PrintInfo.RepeatGridHeader")));
            this.dgrdData.PrintInfo.RepeatSplitHeaders = ((bool)(resources.GetObject("dgrdData.PrintInfo.RepeatSplitHeaders")));
            this.dgrdData.PrintInfo.ShowOptionsDialog = ((bool)(resources.GetObject("dgrdData.PrintInfo.ShowOptionsDialog")));
            this.dgrdData.PrintInfo.ShowProgressForm = ((bool)(resources.GetObject("dgrdData.PrintInfo.ShowProgressForm")));
            this.dgrdData.PrintInfo.ShowSelection = ((bool)(resources.GetObject("dgrdData.PrintInfo.ShowSelection")));
            this.dgrdData.PrintInfo.UseGridColors = ((bool)(resources.GetObject("dgrdData.PrintInfo.UseGridColors")));
            this.dgrdData.RecordSelectorStyle = style11;
            this.dgrdData.RowDivider.Color = ((System.Drawing.Color)(resources.GetObject("resource.Color")));
            this.dgrdData.RowDivider.Style = ((C1.Win.C1TrueDBGrid.LineStyleEnum)(resources.GetObject("resource.Style")));
            this.dgrdData.SelectedStyle = style12;
            this.dgrdData.Style = style13;
            this.dgrdData.BeforeColEdit += new C1.Win.C1TrueDBGrid.BeforeColEditEventHandler(this.dgrdData_BeforeColEdit);
            this.dgrdData.ButtonClick += new C1.Win.C1TrueDBGrid.ColEventHandler(this.dgrdData_ButtonClick);
            this.dgrdData.BeforeColUpdate += new C1.Win.C1TrueDBGrid.BeforeColUpdateEventHandler(this.dgrdData_BeforeColUpdate);
            this.dgrdData.BeforeDelete += new C1.Win.C1TrueDBGrid.CancelEventHandler(this.dgrdData_BeforeDelete);
            this.dgrdData.MouseDown += new System.Windows.Forms.MouseEventHandler(this.dgrdData_MouseDown);
            this.dgrdData.KeyDown += new System.Windows.Forms.KeyEventHandler(this.dgrdData_KeyDown);
            this.dgrdData.AfterDelete += new System.EventHandler(this.dgrdData_AfterDelete);
            this.dgrdData.AfterColUpdate += new C1.Win.C1TrueDBGrid.ColEventHandler(this.dgrdData_AfterColUpdate);
            this.dgrdData.RowColChange += new C1.Win.C1TrueDBGrid.RowColChangeEventHandler(this.dgrdData_RowColChange);
            // 
            // txtInvoiceNo
            // 
            this.txtInvoiceNo.AccessibleDescription = null;
            this.txtInvoiceNo.AccessibleName = null;
            resources.ApplyResources(this.txtInvoiceNo, "txtInvoiceNo");
            this.txtInvoiceNo.BackgroundImage = null;
            this.txtInvoiceNo.Font = null;
            this.txtInvoiceNo.Name = "txtInvoiceNo";
            this.txtInvoiceNo.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtInvoiceNo_KeyDown);
            this.txtInvoiceNo.Validating += new System.ComponentModel.CancelEventHandler(this.txtInvoiceNo_Validating);
            // 
            // txtVendor
            // 
            this.txtVendor.AccessibleDescription = null;
            this.txtVendor.AccessibleName = null;
            resources.ApplyResources(this.txtVendor, "txtVendor");
            this.txtVendor.BackgroundImage = null;
            this.txtVendor.Font = null;
            this.txtVendor.Name = "txtVendor";
            this.txtVendor.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtVendor_KeyDown);
            this.txtVendor.Validating += new System.ComponentModel.CancelEventHandler(this.txtVendor_Validating);
            // 
            // txtVendorName
            // 
            this.txtVendorName.AccessibleDescription = null;
            this.txtVendorName.AccessibleName = null;
            resources.ApplyResources(this.txtVendorName, "txtVendorName");
            this.txtVendorName.BackgroundImage = null;
            this.txtVendorName.Font = null;
            this.txtVendorName.Name = "txtVendorName";
            this.txtVendorName.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtVendorName_KeyDown);
            this.txtVendorName.Validating += new System.ComponentModel.CancelEventHandler(this.txtVendorName_Validating);
            // 
            // numTotalVatAmount
            // 
            resources.ApplyResources(this.numTotalVatAmount, "numTotalVatAmount");
            this.numTotalVatAmount.AccessibleDescription = null;
            this.numTotalVatAmount.AccessibleName = null;
            this.numTotalVatAmount.BackgroundImage = null;
            // 
            // 
            // 
            this.numTotalVatAmount.Calculator.AccessibleDescription = null;
            this.numTotalVatAmount.Calculator.AccessibleName = null;
            this.numTotalVatAmount.Calculator.BackgroundImage = null;
            this.numTotalVatAmount.Calculator.BackgroundImageLayout = ((System.Windows.Forms.ImageLayout)(resources.GetObject("numTotalVatAmount.Calculator.BackgroundImageLayout")));
            this.numTotalVatAmount.Calculator.ButtonFlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("numTotalVatAmount.Calculator.ButtonFlatStyle")));
            this.numTotalVatAmount.Calculator.DisplayFormat = resources.GetString("numTotalVatAmount.Calculator.DisplayFormat");
            this.numTotalVatAmount.Calculator.Font = null;
            this.numTotalVatAmount.Calculator.FormatOnClose = ((bool)(resources.GetObject("numTotalVatAmount.Calculator.FormatOnClose")));
            this.numTotalVatAmount.Calculator.StoredFormat = resources.GetString("numTotalVatAmount.Calculator.StoredFormat");
            this.numTotalVatAmount.Calculator.UIStrings.Content = ((string[])(resources.GetObject("numTotalVatAmount.Calculator.UIStrings.Content")));
            this.numTotalVatAmount.DisplayFormat.Inherit = ((C1.Win.C1Input.FormatInfoInheritFlags)(resources.GetObject("numTotalVatAmount.DisplayFormat.Inherit")));
            this.numTotalVatAmount.EditFormat.Inherit = ((C1.Win.C1Input.FormatInfoInheritFlags)(resources.GetObject("numTotalVatAmount.EditFormat.Inherit")));
            this.numTotalVatAmount.EditMask = null;
            this.numTotalVatAmount.ErrorInfo.BeepOnError = ((bool)(resources.GetObject("numTotalVatAmount.ErrorInfo.BeepOnError")));
            this.numTotalVatAmount.ErrorInfo.ErrorMessage = resources.GetString("numTotalVatAmount.ErrorInfo.ErrorMessage");
            this.numTotalVatAmount.ErrorInfo.ErrorMessageCaption = resources.GetString("numTotalVatAmount.ErrorInfo.ErrorMessageCaption");
            this.numTotalVatAmount.ErrorInfo.ShowErrorMessage = ((bool)(resources.GetObject("numTotalVatAmount.ErrorInfo.ShowErrorMessage")));
            this.numTotalVatAmount.Font = null;
            this.numTotalVatAmount.MaskInfo.AutoTabWhenFilled = ((bool)(resources.GetObject("numTotalVatAmount.MaskInfo.AutoTabWhenFilled")));
            this.numTotalVatAmount.MaskInfo.Inherit = ((C1.Win.C1Input.MaskInfoInheritFlags)(resources.GetObject("numTotalVatAmount.MaskInfo.Inherit")));
            this.numTotalVatAmount.MaskInfo.PromptChar = ((char)(resources.GetObject("numTotalVatAmount.MaskInfo.PromptChar")));
            this.numTotalVatAmount.MaskInfo.ShowLiterals = ((C1.Win.C1Input.ShowLiteralsEnum)(resources.GetObject("numTotalVatAmount.MaskInfo.ShowLiterals")));
            this.numTotalVatAmount.MaskInfo.StoredEmptyChar = ((char)(resources.GetObject("numTotalVatAmount.MaskInfo.StoredEmptyChar")));
            this.numTotalVatAmount.Name = "numTotalVatAmount";
            this.numTotalVatAmount.ParseInfo.Inherit = ((C1.Win.C1Input.ParseInfoInheritFlags)(resources.GetObject("numTotalVatAmount.ParseInfo.Inherit")));
            this.numTotalVatAmount.ParseInfo.NumberStyle = ((C1.Win.C1Input.NumberStyleFlags)(resources.GetObject("numTotalVatAmount.ParseInfo.NumberStyle")));
            this.numTotalVatAmount.PostValidation.Inherit = ((C1.Win.C1Input.PostValidationInheritFlags)(resources.GetObject("numTotalVatAmount.PostValidation.Inherit")));
            this.numTotalVatAmount.PostValidation.Validation = ((C1.Win.C1Input.PostValidationTypeEnum)(resources.GetObject("numTotalVatAmount.PostValidation.Validation")));
            this.numTotalVatAmount.PreValidation.Inherit = ((C1.Win.C1Input.PreValidationInheritFlags)(resources.GetObject("numTotalVatAmount.PreValidation.Inherit")));
            this.numTotalVatAmount.PreValidation.ItemSeparator = resources.GetString("numTotalVatAmount.PreValidation.ItemSeparator");
            this.numTotalVatAmount.PreValidation.PatternString = resources.GetString("numTotalVatAmount.PreValidation.PatternString");
            this.numTotalVatAmount.PreValidation.RegexOptions = ((C1.Win.C1Input.RegexOptionFlags)(resources.GetObject("numTotalVatAmount.PreValidation.RegexOptions")));
            this.numTotalVatAmount.PreValidation.Validation = ((C1.Win.C1Input.PreValidationTypeEnum)(resources.GetObject("numTotalVatAmount.PreValidation.Validation")));
            this.numTotalVatAmount.ReadOnly = true;
            this.numTotalVatAmount.TabStop = false;
            this.numTotalVatAmount.Tag = null;
            // 
            // numTotalBeforeVAT
            // 
            resources.ApplyResources(this.numTotalBeforeVAT, "numTotalBeforeVAT");
            this.numTotalBeforeVAT.AccessibleDescription = null;
            this.numTotalBeforeVAT.AccessibleName = null;
            this.numTotalBeforeVAT.BackgroundImage = null;
            // 
            // 
            // 
            this.numTotalBeforeVAT.Calculator.AccessibleDescription = null;
            this.numTotalBeforeVAT.Calculator.AccessibleName = null;
            this.numTotalBeforeVAT.Calculator.BackgroundImage = null;
            this.numTotalBeforeVAT.Calculator.BackgroundImageLayout = ((System.Windows.Forms.ImageLayout)(resources.GetObject("numTotalBeforeVAT.Calculator.BackgroundImageLayout")));
            this.numTotalBeforeVAT.Calculator.ButtonFlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("numTotalBeforeVAT.Calculator.ButtonFlatStyle")));
            this.numTotalBeforeVAT.Calculator.DisplayFormat = resources.GetString("numTotalBeforeVAT.Calculator.DisplayFormat");
            this.numTotalBeforeVAT.Calculator.Font = null;
            this.numTotalBeforeVAT.Calculator.FormatOnClose = ((bool)(resources.GetObject("numTotalBeforeVAT.Calculator.FormatOnClose")));
            this.numTotalBeforeVAT.Calculator.StoredFormat = resources.GetString("numTotalBeforeVAT.Calculator.StoredFormat");
            this.numTotalBeforeVAT.Calculator.UIStrings.Content = ((string[])(resources.GetObject("numTotalBeforeVAT.Calculator.UIStrings.Content")));
            this.numTotalBeforeVAT.DisplayFormat.Inherit = ((C1.Win.C1Input.FormatInfoInheritFlags)(resources.GetObject("numTotalBeforeVAT.DisplayFormat.Inherit")));
            this.numTotalBeforeVAT.EditFormat.Inherit = ((C1.Win.C1Input.FormatInfoInheritFlags)(resources.GetObject("numTotalBeforeVAT.EditFormat.Inherit")));
            this.numTotalBeforeVAT.EditMask = null;
            this.numTotalBeforeVAT.ErrorInfo.BeepOnError = ((bool)(resources.GetObject("numTotalBeforeVAT.ErrorInfo.BeepOnError")));
            this.numTotalBeforeVAT.ErrorInfo.ErrorMessage = resources.GetString("numTotalBeforeVAT.ErrorInfo.ErrorMessage");
            this.numTotalBeforeVAT.ErrorInfo.ErrorMessageCaption = resources.GetString("numTotalBeforeVAT.ErrorInfo.ErrorMessageCaption");
            this.numTotalBeforeVAT.ErrorInfo.ShowErrorMessage = ((bool)(resources.GetObject("numTotalBeforeVAT.ErrorInfo.ShowErrorMessage")));
            this.numTotalBeforeVAT.Font = null;
            this.numTotalBeforeVAT.MaskInfo.AutoTabWhenFilled = ((bool)(resources.GetObject("numTotalBeforeVAT.MaskInfo.AutoTabWhenFilled")));
            this.numTotalBeforeVAT.MaskInfo.Inherit = ((C1.Win.C1Input.MaskInfoInheritFlags)(resources.GetObject("numTotalBeforeVAT.MaskInfo.Inherit")));
            this.numTotalBeforeVAT.MaskInfo.PromptChar = ((char)(resources.GetObject("numTotalBeforeVAT.MaskInfo.PromptChar")));
            this.numTotalBeforeVAT.MaskInfo.ShowLiterals = ((C1.Win.C1Input.ShowLiteralsEnum)(resources.GetObject("numTotalBeforeVAT.MaskInfo.ShowLiterals")));
            this.numTotalBeforeVAT.MaskInfo.StoredEmptyChar = ((char)(resources.GetObject("numTotalBeforeVAT.MaskInfo.StoredEmptyChar")));
            this.numTotalBeforeVAT.Name = "numTotalBeforeVAT";
            this.numTotalBeforeVAT.ParseInfo.Inherit = ((C1.Win.C1Input.ParseInfoInheritFlags)(resources.GetObject("numTotalBeforeVAT.ParseInfo.Inherit")));
            this.numTotalBeforeVAT.ParseInfo.NumberStyle = ((C1.Win.C1Input.NumberStyleFlags)(resources.GetObject("numTotalBeforeVAT.ParseInfo.NumberStyle")));
            this.numTotalBeforeVAT.PostValidation.Inherit = ((C1.Win.C1Input.PostValidationInheritFlags)(resources.GetObject("numTotalBeforeVAT.PostValidation.Inherit")));
            this.numTotalBeforeVAT.PostValidation.Validation = ((C1.Win.C1Input.PostValidationTypeEnum)(resources.GetObject("numTotalBeforeVAT.PostValidation.Validation")));
            this.numTotalBeforeVAT.PreValidation.Inherit = ((C1.Win.C1Input.PreValidationInheritFlags)(resources.GetObject("numTotalBeforeVAT.PreValidation.Inherit")));
            this.numTotalBeforeVAT.PreValidation.ItemSeparator = resources.GetString("numTotalBeforeVAT.PreValidation.ItemSeparator");
            this.numTotalBeforeVAT.PreValidation.PatternString = resources.GetString("numTotalBeforeVAT.PreValidation.PatternString");
            this.numTotalBeforeVAT.PreValidation.RegexOptions = ((C1.Win.C1Input.RegexOptionFlags)(resources.GetObject("numTotalBeforeVAT.PreValidation.RegexOptions")));
            this.numTotalBeforeVAT.PreValidation.Validation = ((C1.Win.C1Input.PreValidationTypeEnum)(resources.GetObject("numTotalBeforeVAT.PreValidation.Validation")));
            this.numTotalBeforeVAT.ReadOnly = true;
            this.numTotalBeforeVAT.TabStop = false;
            this.numTotalBeforeVAT.Tag = null;
            // 
            // numTotalImpTax
            // 
            resources.ApplyResources(this.numTotalImpTax, "numTotalImpTax");
            this.numTotalImpTax.AccessibleDescription = null;
            this.numTotalImpTax.AccessibleName = null;
            this.numTotalImpTax.BackgroundImage = null;
            // 
            // 
            // 
            this.numTotalImpTax.Calculator.AccessibleDescription = null;
            this.numTotalImpTax.Calculator.AccessibleName = null;
            this.numTotalImpTax.Calculator.BackgroundImage = null;
            this.numTotalImpTax.Calculator.BackgroundImageLayout = ((System.Windows.Forms.ImageLayout)(resources.GetObject("numTotalImpTax.Calculator.BackgroundImageLayout")));
            this.numTotalImpTax.Calculator.ButtonFlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("numTotalImpTax.Calculator.ButtonFlatStyle")));
            this.numTotalImpTax.Calculator.DisplayFormat = resources.GetString("numTotalImpTax.Calculator.DisplayFormat");
            this.numTotalImpTax.Calculator.Font = null;
            this.numTotalImpTax.Calculator.FormatOnClose = ((bool)(resources.GetObject("numTotalImpTax.Calculator.FormatOnClose")));
            this.numTotalImpTax.Calculator.StoredFormat = resources.GetString("numTotalImpTax.Calculator.StoredFormat");
            this.numTotalImpTax.Calculator.UIStrings.Content = ((string[])(resources.GetObject("numTotalImpTax.Calculator.UIStrings.Content")));
            this.numTotalImpTax.DisplayFormat.Inherit = ((C1.Win.C1Input.FormatInfoInheritFlags)(resources.GetObject("numTotalImpTax.DisplayFormat.Inherit")));
            this.numTotalImpTax.EditFormat.Inherit = ((C1.Win.C1Input.FormatInfoInheritFlags)(resources.GetObject("numTotalImpTax.EditFormat.Inherit")));
            this.numTotalImpTax.EditMask = null;
            this.numTotalImpTax.ErrorInfo.BeepOnError = ((bool)(resources.GetObject("numTotalImpTax.ErrorInfo.BeepOnError")));
            this.numTotalImpTax.ErrorInfo.ErrorMessage = resources.GetString("numTotalImpTax.ErrorInfo.ErrorMessage");
            this.numTotalImpTax.ErrorInfo.ErrorMessageCaption = resources.GetString("numTotalImpTax.ErrorInfo.ErrorMessageCaption");
            this.numTotalImpTax.ErrorInfo.ShowErrorMessage = ((bool)(resources.GetObject("numTotalImpTax.ErrorInfo.ShowErrorMessage")));
            this.numTotalImpTax.Font = null;
            this.numTotalImpTax.MaskInfo.AutoTabWhenFilled = ((bool)(resources.GetObject("numTotalImpTax.MaskInfo.AutoTabWhenFilled")));
            this.numTotalImpTax.MaskInfo.Inherit = ((C1.Win.C1Input.MaskInfoInheritFlags)(resources.GetObject("numTotalImpTax.MaskInfo.Inherit")));
            this.numTotalImpTax.MaskInfo.PromptChar = ((char)(resources.GetObject("numTotalImpTax.MaskInfo.PromptChar")));
            this.numTotalImpTax.MaskInfo.ShowLiterals = ((C1.Win.C1Input.ShowLiteralsEnum)(resources.GetObject("numTotalImpTax.MaskInfo.ShowLiterals")));
            this.numTotalImpTax.MaskInfo.StoredEmptyChar = ((char)(resources.GetObject("numTotalImpTax.MaskInfo.StoredEmptyChar")));
            this.numTotalImpTax.Name = "numTotalImpTax";
            this.numTotalImpTax.ParseInfo.Inherit = ((C1.Win.C1Input.ParseInfoInheritFlags)(resources.GetObject("numTotalImpTax.ParseInfo.Inherit")));
            this.numTotalImpTax.ParseInfo.NumberStyle = ((C1.Win.C1Input.NumberStyleFlags)(resources.GetObject("numTotalImpTax.ParseInfo.NumberStyle")));
            this.numTotalImpTax.PostValidation.Inherit = ((C1.Win.C1Input.PostValidationInheritFlags)(resources.GetObject("numTotalImpTax.PostValidation.Inherit")));
            this.numTotalImpTax.PostValidation.Validation = ((C1.Win.C1Input.PostValidationTypeEnum)(resources.GetObject("numTotalImpTax.PostValidation.Validation")));
            this.numTotalImpTax.PreValidation.Inherit = ((C1.Win.C1Input.PreValidationInheritFlags)(resources.GetObject("numTotalImpTax.PreValidation.Inherit")));
            this.numTotalImpTax.PreValidation.ItemSeparator = resources.GetString("numTotalImpTax.PreValidation.ItemSeparator");
            this.numTotalImpTax.PreValidation.PatternString = resources.GetString("numTotalImpTax.PreValidation.PatternString");
            this.numTotalImpTax.PreValidation.RegexOptions = ((C1.Win.C1Input.RegexOptionFlags)(resources.GetObject("numTotalImpTax.PreValidation.RegexOptions")));
            this.numTotalImpTax.PreValidation.Validation = ((C1.Win.C1Input.PreValidationTypeEnum)(resources.GetObject("numTotalImpTax.PreValidation.Validation")));
            this.numTotalImpTax.ReadOnly = true;
            this.numTotalImpTax.TabStop = false;
            this.numTotalImpTax.Tag = null;
            // 
            // numTotalCIFAmount
            // 
            resources.ApplyResources(this.numTotalCIFAmount, "numTotalCIFAmount");
            this.numTotalCIFAmount.AccessibleDescription = null;
            this.numTotalCIFAmount.AccessibleName = null;
            this.numTotalCIFAmount.BackgroundImage = null;
            // 
            // 
            // 
            this.numTotalCIFAmount.Calculator.AccessibleDescription = null;
            this.numTotalCIFAmount.Calculator.AccessibleName = null;
            this.numTotalCIFAmount.Calculator.BackgroundImage = null;
            this.numTotalCIFAmount.Calculator.BackgroundImageLayout = ((System.Windows.Forms.ImageLayout)(resources.GetObject("numTotalCIFAmount.Calculator.BackgroundImageLayout")));
            this.numTotalCIFAmount.Calculator.ButtonFlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("numTotalCIFAmount.Calculator.ButtonFlatStyle")));
            this.numTotalCIFAmount.Calculator.DisplayFormat = resources.GetString("numTotalCIFAmount.Calculator.DisplayFormat");
            this.numTotalCIFAmount.Calculator.Font = null;
            this.numTotalCIFAmount.Calculator.FormatOnClose = ((bool)(resources.GetObject("numTotalCIFAmount.Calculator.FormatOnClose")));
            this.numTotalCIFAmount.Calculator.StoredFormat = resources.GetString("numTotalCIFAmount.Calculator.StoredFormat");
            this.numTotalCIFAmount.Calculator.UIStrings.Content = ((string[])(resources.GetObject("numTotalCIFAmount.Calculator.UIStrings.Content")));
            this.numTotalCIFAmount.DisplayFormat.Inherit = ((C1.Win.C1Input.FormatInfoInheritFlags)(resources.GetObject("numTotalCIFAmount.DisplayFormat.Inherit")));
            this.numTotalCIFAmount.EditFormat.Inherit = ((C1.Win.C1Input.FormatInfoInheritFlags)(resources.GetObject("numTotalCIFAmount.EditFormat.Inherit")));
            this.numTotalCIFAmount.EditMask = null;
            this.numTotalCIFAmount.ErrorInfo.BeepOnError = ((bool)(resources.GetObject("numTotalCIFAmount.ErrorInfo.BeepOnError")));
            this.numTotalCIFAmount.ErrorInfo.ErrorMessage = resources.GetString("numTotalCIFAmount.ErrorInfo.ErrorMessage");
            this.numTotalCIFAmount.ErrorInfo.ErrorMessageCaption = resources.GetString("numTotalCIFAmount.ErrorInfo.ErrorMessageCaption");
            this.numTotalCIFAmount.ErrorInfo.ShowErrorMessage = ((bool)(resources.GetObject("numTotalCIFAmount.ErrorInfo.ShowErrorMessage")));
            this.numTotalCIFAmount.Font = null;
            this.numTotalCIFAmount.MaskInfo.AutoTabWhenFilled = ((bool)(resources.GetObject("numTotalCIFAmount.MaskInfo.AutoTabWhenFilled")));
            this.numTotalCIFAmount.MaskInfo.Inherit = ((C1.Win.C1Input.MaskInfoInheritFlags)(resources.GetObject("numTotalCIFAmount.MaskInfo.Inherit")));
            this.numTotalCIFAmount.MaskInfo.PromptChar = ((char)(resources.GetObject("numTotalCIFAmount.MaskInfo.PromptChar")));
            this.numTotalCIFAmount.MaskInfo.ShowLiterals = ((C1.Win.C1Input.ShowLiteralsEnum)(resources.GetObject("numTotalCIFAmount.MaskInfo.ShowLiterals")));
            this.numTotalCIFAmount.MaskInfo.StoredEmptyChar = ((char)(resources.GetObject("numTotalCIFAmount.MaskInfo.StoredEmptyChar")));
            this.numTotalCIFAmount.Name = "numTotalCIFAmount";
            this.numTotalCIFAmount.ParseInfo.Inherit = ((C1.Win.C1Input.ParseInfoInheritFlags)(resources.GetObject("numTotalCIFAmount.ParseInfo.Inherit")));
            this.numTotalCIFAmount.ParseInfo.NumberStyle = ((C1.Win.C1Input.NumberStyleFlags)(resources.GetObject("numTotalCIFAmount.ParseInfo.NumberStyle")));
            this.numTotalCIFAmount.PostValidation.Inherit = ((C1.Win.C1Input.PostValidationInheritFlags)(resources.GetObject("numTotalCIFAmount.PostValidation.Inherit")));
            this.numTotalCIFAmount.PostValidation.Validation = ((C1.Win.C1Input.PostValidationTypeEnum)(resources.GetObject("numTotalCIFAmount.PostValidation.Validation")));
            this.numTotalCIFAmount.PreValidation.Inherit = ((C1.Win.C1Input.PreValidationInheritFlags)(resources.GetObject("numTotalCIFAmount.PreValidation.Inherit")));
            this.numTotalCIFAmount.PreValidation.ItemSeparator = resources.GetString("numTotalCIFAmount.PreValidation.ItemSeparator");
            this.numTotalCIFAmount.PreValidation.PatternString = resources.GetString("numTotalCIFAmount.PreValidation.PatternString");
            this.numTotalCIFAmount.PreValidation.RegexOptions = ((C1.Win.C1Input.RegexOptionFlags)(resources.GetObject("numTotalCIFAmount.PreValidation.RegexOptions")));
            this.numTotalCIFAmount.PreValidation.Validation = ((C1.Win.C1Input.PreValidationTypeEnum)(resources.GetObject("numTotalCIFAmount.PreValidation.Validation")));
            this.numTotalCIFAmount.ReadOnly = true;
            this.numTotalCIFAmount.TabStop = false;
            this.numTotalCIFAmount.Tag = null;
            // 
            // btnVendorName
            // 
            this.btnVendorName.AccessibleDescription = null;
            this.btnVendorName.AccessibleName = null;
            resources.ApplyResources(this.btnVendorName, "btnVendorName");
            this.btnVendorName.BackgroundImage = null;
            this.btnVendorName.Font = null;
            this.btnVendorName.Name = "btnVendorName";
            this.btnVendorName.Click += new System.EventHandler(this.btnVendorName_Click);
            // 
            // numExchRate
            // 
            resources.ApplyResources(this.numExchRate, "numExchRate");
            this.numExchRate.AccessibleDescription = null;
            this.numExchRate.AccessibleName = null;
            this.numExchRate.BackgroundImage = null;
            // 
            // 
            // 
            this.numExchRate.Calculator.AccessibleDescription = null;
            this.numExchRate.Calculator.AccessibleName = null;
            this.numExchRate.Calculator.BackgroundImage = null;
            this.numExchRate.Calculator.BackgroundImageLayout = ((System.Windows.Forms.ImageLayout)(resources.GetObject("numExchRate.Calculator.BackgroundImageLayout")));
            this.numExchRate.Calculator.ButtonFlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("numExchRate.Calculator.ButtonFlatStyle")));
            this.numExchRate.Calculator.DisplayFormat = resources.GetString("numExchRate.Calculator.DisplayFormat");
            this.numExchRate.Calculator.Font = null;
            this.numExchRate.Calculator.FormatOnClose = ((bool)(resources.GetObject("numExchRate.Calculator.FormatOnClose")));
            this.numExchRate.Calculator.StoredFormat = resources.GetString("numExchRate.Calculator.StoredFormat");
            this.numExchRate.Calculator.UIStrings.Content = ((string[])(resources.GetObject("numExchRate.Calculator.UIStrings.Content")));
            this.numExchRate.DisplayFormat.Inherit = ((C1.Win.C1Input.FormatInfoInheritFlags)(resources.GetObject("numExchRate.DisplayFormat.Inherit")));
            this.numExchRate.EditFormat.Inherit = ((C1.Win.C1Input.FormatInfoInheritFlags)(resources.GetObject("numExchRate.EditFormat.Inherit")));
            this.numExchRate.EditMask = null;
            this.numExchRate.ErrorInfo.BeepOnError = ((bool)(resources.GetObject("numExchRate.ErrorInfo.BeepOnError")));
            this.numExchRate.ErrorInfo.ErrorMessage = resources.GetString("numExchRate.ErrorInfo.ErrorMessage");
            this.numExchRate.ErrorInfo.ErrorMessageCaption = resources.GetString("numExchRate.ErrorInfo.ErrorMessageCaption");
            this.numExchRate.ErrorInfo.ShowErrorMessage = ((bool)(resources.GetObject("numExchRate.ErrorInfo.ShowErrorMessage")));
            this.numExchRate.Font = null;
            this.numExchRate.MaskInfo.AutoTabWhenFilled = ((bool)(resources.GetObject("numExchRate.MaskInfo.AutoTabWhenFilled")));
            this.numExchRate.MaskInfo.Inherit = ((C1.Win.C1Input.MaskInfoInheritFlags)(resources.GetObject("numExchRate.MaskInfo.Inherit")));
            this.numExchRate.MaskInfo.PromptChar = ((char)(resources.GetObject("numExchRate.MaskInfo.PromptChar")));
            this.numExchRate.MaskInfo.ShowLiterals = ((C1.Win.C1Input.ShowLiteralsEnum)(resources.GetObject("numExchRate.MaskInfo.ShowLiterals")));
            this.numExchRate.MaskInfo.StoredEmptyChar = ((char)(resources.GetObject("numExchRate.MaskInfo.StoredEmptyChar")));
            this.numExchRate.Name = "numExchRate";
            this.numExchRate.NumericInputKeys = ((C1.Win.C1Input.NumericInputKeyFlags)((((C1.Win.C1Input.NumericInputKeyFlags.F9 | C1.Win.C1Input.NumericInputKeyFlags.Plus)
                        | C1.Win.C1Input.NumericInputKeyFlags.Decimal)
                        | C1.Win.C1Input.NumericInputKeyFlags.X)));
            this.numExchRate.ParseInfo.Inherit = ((C1.Win.C1Input.ParseInfoInheritFlags)(resources.GetObject("numExchRate.ParseInfo.Inherit")));
            this.numExchRate.ParseInfo.NumberStyle = ((C1.Win.C1Input.NumberStyleFlags)(resources.GetObject("numExchRate.ParseInfo.NumberStyle")));
            this.numExchRate.PostValidation.Inherit = ((C1.Win.C1Input.PostValidationInheritFlags)(resources.GetObject("numExchRate.PostValidation.Inherit")));
            this.numExchRate.PostValidation.Validation = ((C1.Win.C1Input.PostValidationTypeEnum)(resources.GetObject("numExchRate.PostValidation.Validation")));
            this.numExchRate.PreValidation.Inherit = ((C1.Win.C1Input.PreValidationInheritFlags)(resources.GetObject("numExchRate.PreValidation.Inherit")));
            this.numExchRate.PreValidation.ItemSeparator = resources.GetString("numExchRate.PreValidation.ItemSeparator");
            this.numExchRate.PreValidation.PatternString = resources.GetString("numExchRate.PreValidation.PatternString");
            this.numExchRate.PreValidation.RegexOptions = ((C1.Win.C1Input.RegexOptionFlags)(resources.GetObject("numExchRate.PreValidation.RegexOptions")));
            this.numExchRate.PreValidation.Validation = ((C1.Win.C1Input.PreValidationTypeEnum)(resources.GetObject("numExchRate.PreValidation.Validation")));
            this.numExchRate.Tag = null;
            // 
            // dtmPostDate
            // 
            resources.ApplyResources(this.dtmPostDate, "dtmPostDate");
            this.dtmPostDate.AccessibleDescription = null;
            this.dtmPostDate.AccessibleName = null;
            this.dtmPostDate.BackgroundImage = null;
            // 
            // 
            // 
            this.dtmPostDate.Calendar.AccessibleDescription = null;
            this.dtmPostDate.Calendar.AccessibleName = null;
            this.dtmPostDate.Calendar.BackgroundImage = null;
            this.dtmPostDate.Calendar.BackgroundImageLayout = ((System.Windows.Forms.ImageLayout)(resources.GetObject("dtmPostDate.Calendar.BackgroundImageLayout")));
            this.dtmPostDate.Calendar.FirstDayOfWeek = ((System.Windows.Forms.Day)(resources.GetObject("dtmPostDate.Calendar.FirstDayOfWeek")));
            this.dtmPostDate.Calendar.Font = null;
            this.dtmPostDate.Calendar.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("dtmPostDate.Calendar.ImeMode")));
            this.dtmPostDate.Calendar.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("dtmPostDate.Calendar.RightToLeft")));
            this.dtmPostDate.Calendar.RightToLeftLayout = ((bool)(resources.GetObject("dtmPostDate.Calendar.RightToLeftLayout")));
            this.dtmPostDate.Calendar.ShowClearButton = ((bool)(resources.GetObject("dtmPostDate.Calendar.ShowClearButton")));
            this.dtmPostDate.Calendar.ShowTodayButton = ((bool)(resources.GetObject("dtmPostDate.Calendar.ShowTodayButton")));
            this.dtmPostDate.Calendar.ShowWeekNumbers = ((bool)(resources.GetObject("dtmPostDate.Calendar.ShowWeekNumbers")));
            this.dtmPostDate.DisplayFormat.Inherit = ((C1.Win.C1Input.FormatInfoInheritFlags)(resources.GetObject("dtmPostDate.DisplayFormat.Inherit")));
            this.dtmPostDate.EditFormat.Inherit = ((C1.Win.C1Input.FormatInfoInheritFlags)(resources.GetObject("dtmPostDate.EditFormat.Inherit")));
            this.dtmPostDate.EditMask = null;
            this.dtmPostDate.ErrorInfo.BeepOnError = ((bool)(resources.GetObject("dtmPostDate.ErrorInfo.BeepOnError")));
            this.dtmPostDate.ErrorInfo.ErrorMessage = resources.GetString("dtmPostDate.ErrorInfo.ErrorMessage");
            this.dtmPostDate.ErrorInfo.ErrorMessageCaption = resources.GetString("dtmPostDate.ErrorInfo.ErrorMessageCaption");
            this.dtmPostDate.ErrorInfo.ShowErrorMessage = ((bool)(resources.GetObject("dtmPostDate.ErrorInfo.ShowErrorMessage")));
            this.dtmPostDate.Font = null;
            this.dtmPostDate.MaskInfo.AutoTabWhenFilled = ((bool)(resources.GetObject("dtmPostDate.MaskInfo.AutoTabWhenFilled")));
            this.dtmPostDate.MaskInfo.Inherit = ((C1.Win.C1Input.MaskInfoInheritFlags)(resources.GetObject("dtmPostDate.MaskInfo.Inherit")));
            this.dtmPostDate.MaskInfo.PromptChar = ((char)(resources.GetObject("dtmPostDate.MaskInfo.PromptChar")));
            this.dtmPostDate.MaskInfo.ShowLiterals = ((C1.Win.C1Input.ShowLiteralsEnum)(resources.GetObject("dtmPostDate.MaskInfo.ShowLiterals")));
            this.dtmPostDate.MaskInfo.StoredEmptyChar = ((char)(resources.GetObject("dtmPostDate.MaskInfo.StoredEmptyChar")));
            this.dtmPostDate.Name = "dtmPostDate";
            this.dtmPostDate.ParseInfo.DateTimeStyle = ((C1.Win.C1Input.DateTimeStyleFlags)(resources.GetObject("dtmPostDate.ParseInfo.DateTimeStyle")));
            this.dtmPostDate.ParseInfo.Inherit = ((C1.Win.C1Input.ParseInfoInheritFlags)(resources.GetObject("dtmPostDate.ParseInfo.Inherit")));
            this.dtmPostDate.PostValidation.Inherit = ((C1.Win.C1Input.PostValidationInheritFlags)(resources.GetObject("dtmPostDate.PostValidation.Inherit")));
            this.dtmPostDate.PostValidation.Validation = ((C1.Win.C1Input.PostValidationTypeEnum)(resources.GetObject("dtmPostDate.PostValidation.Validation")));
            this.dtmPostDate.PreValidation.Inherit = ((C1.Win.C1Input.PreValidationInheritFlags)(resources.GetObject("dtmPostDate.PreValidation.Inherit")));
            this.dtmPostDate.PreValidation.ItemSeparator = resources.GetString("dtmPostDate.PreValidation.ItemSeparator");
            this.dtmPostDate.PreValidation.PatternString = resources.GetString("dtmPostDate.PreValidation.PatternString");
            this.dtmPostDate.PreValidation.RegexOptions = ((C1.Win.C1Input.RegexOptionFlags)(resources.GetObject("dtmPostDate.PreValidation.RegexOptions")));
            this.dtmPostDate.PreValidation.Validation = ((C1.Win.C1Input.PreValidationTypeEnum)(resources.GetObject("dtmPostDate.PreValidation.Validation")));
            this.dtmPostDate.Tag = null;
            // 
            // btnCurrency
            // 
            this.btnCurrency.AccessibleDescription = null;
            this.btnCurrency.AccessibleName = null;
            resources.ApplyResources(this.btnCurrency, "btnCurrency");
            this.btnCurrency.BackgroundImage = null;
            this.btnCurrency.Font = null;
            this.btnCurrency.Name = "btnCurrency";
            this.btnCurrency.Click += new System.EventHandler(this.btnCurrency_Click);
            // 
            // btnCarrier
            // 
            this.btnCarrier.AccessibleDescription = null;
            this.btnCarrier.AccessibleName = null;
            resources.ApplyResources(this.btnCarrier, "btnCarrier");
            this.btnCarrier.BackgroundImage = null;
            this.btnCarrier.Font = null;
            this.btnCarrier.Name = "btnCarrier";
            this.btnCarrier.Click += new System.EventHandler(this.btnCarrier_Click);
            // 
            // btnPayTerms
            // 
            this.btnPayTerms.AccessibleDescription = null;
            this.btnPayTerms.AccessibleName = null;
            resources.ApplyResources(this.btnPayTerms, "btnPayTerms");
            this.btnPayTerms.BackgroundImage = null;
            this.btnPayTerms.Font = null;
            this.btnPayTerms.Name = "btnPayTerms";
            this.btnPayTerms.Click += new System.EventHandler(this.btnPayTerms_Click);
            // 
            // btnDeliveryTerms
            // 
            this.btnDeliveryTerms.AccessibleDescription = null;
            this.btnDeliveryTerms.AccessibleName = null;
            resources.ApplyResources(this.btnDeliveryTerms, "btnDeliveryTerms");
            this.btnDeliveryTerms.BackgroundImage = null;
            this.btnDeliveryTerms.Font = null;
            this.btnDeliveryTerms.Name = "btnDeliveryTerms";
            this.btnDeliveryTerms.Click += new System.EventHandler(this.btnDeliveryTerms_Click);
            // 
            // lblTotalImpTax
            // 
            this.lblTotalImpTax.AccessibleDescription = null;
            this.lblTotalImpTax.AccessibleName = null;
            resources.ApplyResources(this.lblTotalImpTax, "lblTotalImpTax");
            this.lblTotalImpTax.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.lblTotalImpTax.Font = null;
            this.lblTotalImpTax.Name = "lblTotalImpTax";
            // 
            // lblTotalDiscount
            // 
            this.lblTotalDiscount.AccessibleDescription = null;
            this.lblTotalDiscount.AccessibleName = null;
            resources.ApplyResources(this.lblTotalDiscount, "lblTotalDiscount");
            this.lblTotalDiscount.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.lblTotalDiscount.Font = null;
            this.lblTotalDiscount.Name = "lblTotalDiscount";
            // 
            // lblSpecTax
            // 
            this.lblSpecTax.AccessibleDescription = null;
            this.lblSpecTax.AccessibleName = null;
            resources.ApplyResources(this.lblSpecTax, "lblSpecTax");
            this.lblSpecTax.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.lblSpecTax.Font = null;
            this.lblSpecTax.Name = "lblSpecTax";
            // 
            // lblTotalVAT
            // 
            this.lblTotalVAT.AccessibleDescription = null;
            this.lblTotalVAT.AccessibleName = null;
            resources.ApplyResources(this.lblTotalVAT, "lblTotalVAT");
            this.lblTotalVAT.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.lblTotalVAT.Font = null;
            this.lblTotalVAT.Name = "lblTotalVAT";
            // 
            // btnEdit
            // 
            this.btnEdit.AccessibleDescription = null;
            this.btnEdit.AccessibleName = null;
            resources.ApplyResources(this.btnEdit, "btnEdit");
            this.btnEdit.BackgroundImage = null;
            this.btnEdit.Font = null;
            this.btnEdit.Name = "btnEdit";
            this.btnEdit.Click += new System.EventHandler(this.btnEdit_Click);
            // 
            // btnClose
            // 
            this.btnClose.AccessibleDescription = null;
            this.btnClose.AccessibleName = null;
            resources.ApplyResources(this.btnClose, "btnClose");
            this.btnClose.BackgroundImage = null;
            this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.btnClose.Font = null;
            this.btnClose.Name = "btnClose";
            this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
            // 
            // btnHelp
            // 
            this.btnHelp.AccessibleDescription = null;
            this.btnHelp.AccessibleName = null;
            resources.ApplyResources(this.btnHelp, "btnHelp");
            this.btnHelp.BackgroundImage = null;
            this.btnHelp.Font = null;
            this.btnHelp.Name = "btnHelp";
            this.btnHelp.Click += new System.EventHandler(this.btnHelp_Click);
            // 
            // btnDelete
            // 
            this.btnDelete.AccessibleDescription = null;
            this.btnDelete.AccessibleName = null;
            resources.ApplyResources(this.btnDelete, "btnDelete");
            this.btnDelete.BackgroundImage = null;
            this.btnDelete.Font = null;
            this.btnDelete.Name = "btnDelete";
            this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
            // 
            // btnSave
            // 
            this.btnSave.AccessibleDescription = null;
            this.btnSave.AccessibleName = null;
            resources.ApplyResources(this.btnSave, "btnSave");
            this.btnSave.BackgroundImage = null;
            this.btnSave.Font = null;
            this.btnSave.Name = "btnSave";
            this.btnSave.Click += new System.EventHandler(this.btnSave_Click);
            // 
            // btnAdd
            // 
            this.btnAdd.AccessibleDescription = null;
            this.btnAdd.AccessibleName = null;
            resources.ApplyResources(this.btnAdd, "btnAdd");
            this.btnAdd.BackgroundImage = null;
            this.btnAdd.Font = null;
            this.btnAdd.Name = "btnAdd";
            this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
            // 
            // btnPrint
            // 
            this.btnPrint.AccessibleDescription = null;
            this.btnPrint.AccessibleName = null;
            resources.ApplyResources(this.btnPrint, "btnPrint");
            this.btnPrint.BackgroundImage = null;
            this.btnPrint.Font = null;
            this.btnPrint.Name = "btnPrint";
            this.btnPrint.Click += new System.EventHandler(this.btnPrint_Click);
            this.btnPrint.EnabledChanged += new System.EventHandler(this.btnPrint_EnabledChanged);
            // 
            // btnInvoiceNo
            // 
            this.btnInvoiceNo.AccessibleDescription = null;
            this.btnInvoiceNo.AccessibleName = null;
            resources.ApplyResources(this.btnInvoiceNo, "btnInvoiceNo");
            this.btnInvoiceNo.BackgroundImage = null;
            this.btnInvoiceNo.Font = null;
            this.btnInvoiceNo.Name = "btnInvoiceNo";
            this.btnInvoiceNo.Click += new System.EventHandler(this.btnInvoiceNo_Click);
            // 
            // btnVendor
            // 
            this.btnVendor.AccessibleDescription = null;
            this.btnVendor.AccessibleName = null;
            resources.ApplyResources(this.btnVendor, "btnVendor");
            this.btnVendor.BackgroundImage = null;
            this.btnVendor.Font = null;
            this.btnVendor.Name = "btnVendor";
            this.btnVendor.Click += new System.EventHandler(this.btnVendor_Click);
            // 
            // cboCCN
            // 
            this.cboCCN.AccessibleDescription = null;
            this.cboCCN.AccessibleName = null;
            this.cboCCN.AddItemSeparator = ';';
            this.cboCCN.AllowRowSizing = C1.Win.C1List.RowSizingEnum.AllRows;
            resources.ApplyResources(this.cboCCN, "cboCCN");
            this.cboCCN.BackgroundImage = null;
            this.cboCCN.Caption = "";
            this.cboCCN.CaptionHeight = 17;
            this.cboCCN.CaptionStyle = style14;
            this.cboCCN.CharacterCasing = System.Windows.Forms.CharacterCasing.Normal;
            this.cboCCN.ColumnCaptionHeight = 17;
            this.cboCCN.ColumnFooterHeight = 17;
            this.cboCCN.ComboStyle = C1.Win.C1List.ComboStyleEnum.DropdownList;
            this.cboCCN.ContentHeight = 15;
            this.cboCCN.DeadAreaBackColor = System.Drawing.Color.Empty;
            this.cboCCN.DropDownWidth = 200;
            this.cboCCN.EditorBackColor = System.Drawing.SystemColors.Window;
            this.cboCCN.EditorFont = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.cboCCN.EditorForeColor = System.Drawing.SystemColors.WindowText;
            this.cboCCN.EditorHeight = 15;
            this.cboCCN.EvenRowStyle = style15;
            this.cboCCN.FlatStyle = C1.Win.C1List.FlatModeEnum.System;
            this.cboCCN.Font = null;
            this.cboCCN.FooterStyle = style16;
            this.cboCCN.GapHeight = 2;
            this.cboCCN.HeadingStyle = style17;
            this.cboCCN.HighLightRowStyle = style18;
            this.cboCCN.ItemHeight = 15;
            this.cboCCN.MatchEntryTimeout = ((long)(2000));
            this.cboCCN.MaxDropDownItems = ((short)(5));
            this.cboCCN.MaxLength = 32767;
            this.cboCCN.MouseCursor = System.Windows.Forms.Cursors.Default;
            this.cboCCN.Name = "cboCCN";
            this.cboCCN.OddRowStyle = style19;
            this.cboCCN.PartialRightColumn = false;
            this.cboCCN.RowDivider.Color = System.Drawing.Color.DarkGray;
            this.cboCCN.RowDivider.Style = C1.Win.C1List.LineStyleEnum.None;
            this.cboCCN.RowSubDividerColor = System.Drawing.Color.DarkGray;
            this.cboCCN.SelectedStyle = style20;
            this.cboCCN.Style = style21;
            this.cboCCN.PropBag = resources.GetString("cboCCN.PropBag");
            // 
            // lblCCN
            // 
            this.lblCCN.AccessibleDescription = null;
            this.lblCCN.AccessibleName = null;
            resources.ApplyResources(this.lblCCN, "lblCCN");
            this.lblCCN.Font = null;
            this.lblCCN.ForeColor = System.Drawing.Color.Maroon;
            this.lblCCN.Name = "lblCCN";
            // 
            // lblExchRate
            // 
            this.lblExchRate.AccessibleDescription = null;
            this.lblExchRate.AccessibleName = null;
            resources.ApplyResources(this.lblExchRate, "lblExchRate");
            this.lblExchRate.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.lblExchRate.Font = null;
            this.lblExchRate.ForeColor = System.Drawing.Color.Maroon;
            this.lblExchRate.Name = "lblExchRate";
            // 
            // lblCurrency
            // 
            this.lblCurrency.AccessibleDescription = null;
            this.lblCurrency.AccessibleName = null;
            resources.ApplyResources(this.lblCurrency, "lblCurrency");
            this.lblCurrency.Font = null;
            this.lblCurrency.ForeColor = System.Drawing.Color.Maroon;
            this.lblCurrency.Name = "lblCurrency";
            // 
            // lblVendor
            // 
            this.lblVendor.AccessibleDescription = null;
            this.lblVendor.AccessibleName = null;
            resources.ApplyResources(this.lblVendor, "lblVendor");
            this.lblVendor.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.lblVendor.Font = null;
            this.lblVendor.ForeColor = System.Drawing.Color.Maroon;
            this.lblVendor.Name = "lblVendor";
            // 
            // lblInvoiceNo
            // 
            this.lblInvoiceNo.AccessibleDescription = null;
            this.lblInvoiceNo.AccessibleName = null;
            resources.ApplyResources(this.lblInvoiceNo, "lblInvoiceNo");
            this.lblInvoiceNo.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.lblInvoiceNo.Font = null;
            this.lblInvoiceNo.ForeColor = System.Drawing.Color.Maroon;
            this.lblInvoiceNo.Name = "lblInvoiceNo";
            // 
            // lblOrderDate
            // 
            this.lblOrderDate.AccessibleDescription = null;
            this.lblOrderDate.AccessibleName = null;
            resources.ApplyResources(this.lblOrderDate, "lblOrderDate");
            this.lblOrderDate.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.lblOrderDate.Font = null;
            this.lblOrderDate.ForeColor = System.Drawing.Color.Maroon;
            this.lblOrderDate.Name = "lblOrderDate";
            // 
            // lblPayTerms
            // 
            this.lblPayTerms.AccessibleDescription = null;
            this.lblPayTerms.AccessibleName = null;
            resources.ApplyResources(this.lblPayTerms, "lblPayTerms");
            this.lblPayTerms.Font = null;
            this.lblPayTerms.ForeColor = System.Drawing.Color.Black;
            this.lblPayTerms.Name = "lblPayTerms";
            // 
            // lblDeliveryTerms
            // 
            this.lblDeliveryTerms.AccessibleDescription = null;
            this.lblDeliveryTerms.AccessibleName = null;
            resources.ApplyResources(this.lblDeliveryTerms, "lblDeliveryTerms");
            this.lblDeliveryTerms.Font = null;
            this.lblDeliveryTerms.ForeColor = System.Drawing.Color.Black;
            this.lblDeliveryTerms.Name = "lblDeliveryTerms";
            // 
            // lblCarrier
            // 
            this.lblCarrier.AccessibleDescription = null;
            this.lblCarrier.AccessibleName = null;
            resources.ApplyResources(this.lblCarrier, "lblCarrier");
            this.lblCarrier.Font = null;
            this.lblCarrier.ForeColor = System.Drawing.Color.Black;
            this.lblCarrier.Name = "lblCarrier";
            // 
            // dtmBLDate
            // 
            resources.ApplyResources(this.dtmBLDate, "dtmBLDate");
            this.dtmBLDate.AccessibleDescription = null;
            this.dtmBLDate.AccessibleName = null;
            this.dtmBLDate.BackgroundImage = null;
            // 
            // 
            // 
            this.dtmBLDate.Calendar.AccessibleDescription = null;
            this.dtmBLDate.Calendar.AccessibleName = null;
            this.dtmBLDate.Calendar.BackgroundImage = null;
            this.dtmBLDate.Calendar.BackgroundImageLayout = ((System.Windows.Forms.ImageLayout)(resources.GetObject("dtmBLDate.Calendar.BackgroundImageLayout")));
            this.dtmBLDate.Calendar.FirstDayOfWeek = ((System.Windows.Forms.Day)(resources.GetObject("dtmBLDate.Calendar.FirstDayOfWeek")));
            this.dtmBLDate.Calendar.Font = null;
            this.dtmBLDate.Calendar.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("dtmBLDate.Calendar.ImeMode")));
            this.dtmBLDate.Calendar.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("dtmBLDate.Calendar.RightToLeft")));
            this.dtmBLDate.Calendar.RightToLeftLayout = ((bool)(resources.GetObject("dtmBLDate.Calendar.RightToLeftLayout")));
            this.dtmBLDate.Calendar.ShowClearButton = ((bool)(resources.GetObject("dtmBLDate.Calendar.ShowClearButton")));
            this.dtmBLDate.Calendar.ShowTodayButton = ((bool)(resources.GetObject("dtmBLDate.Calendar.ShowTodayButton")));
            this.dtmBLDate.Calendar.ShowWeekNumbers = ((bool)(resources.GetObject("dtmBLDate.Calendar.ShowWeekNumbers")));
            this.dtmBLDate.DisplayFormat.Inherit = ((C1.Win.C1Input.FormatInfoInheritFlags)(resources.GetObject("dtmBLDate.DisplayFormat.Inherit")));
            this.dtmBLDate.EditFormat.Inherit = ((C1.Win.C1Input.FormatInfoInheritFlags)(resources.GetObject("dtmBLDate.EditFormat.Inherit")));
            this.dtmBLDate.EditMask = null;
            this.dtmBLDate.ErrorInfo.BeepOnError = ((bool)(resources.GetObject("dtmBLDate.ErrorInfo.BeepOnError")));
            this.dtmBLDate.ErrorInfo.ErrorMessage = resources.GetString("dtmBLDate.ErrorInfo.ErrorMessage");
            this.dtmBLDate.ErrorInfo.ErrorMessageCaption = resources.GetString("dtmBLDate.ErrorInfo.ErrorMessageCaption");
            this.dtmBLDate.ErrorInfo.ShowErrorMessage = ((bool)(resources.GetObject("dtmBLDate.ErrorInfo.ShowErrorMessage")));
            this.dtmBLDate.Font = null;
            this.dtmBLDate.MaskInfo.AutoTabWhenFilled = ((bool)(resources.GetObject("dtmBLDate.MaskInfo.AutoTabWhenFilled")));
            this.dtmBLDate.MaskInfo.Inherit = ((C1.Win.C1Input.MaskInfoInheritFlags)(resources.GetObject("dtmBLDate.MaskInfo.Inherit")));
            this.dtmBLDate.MaskInfo.PromptChar = ((char)(resources.GetObject("dtmBLDate.MaskInfo.PromptChar")));
            this.dtmBLDate.MaskInfo.ShowLiterals = ((C1.Win.C1Input.ShowLiteralsEnum)(resources.GetObject("dtmBLDate.MaskInfo.ShowLiterals")));
            this.dtmBLDate.MaskInfo.StoredEmptyChar = ((char)(resources.GetObject("dtmBLDate.MaskInfo.StoredEmptyChar")));
            this.dtmBLDate.MinShortYear = 1000;
            this.dtmBLDate.Name = "dtmBLDate";
            this.dtmBLDate.ParseInfo.DateTimeStyle = ((C1.Win.C1Input.DateTimeStyleFlags)(resources.GetObject("dtmBLDate.ParseInfo.DateTimeStyle")));
            this.dtmBLDate.ParseInfo.Inherit = ((C1.Win.C1Input.ParseInfoInheritFlags)(resources.GetObject("dtmBLDate.ParseInfo.Inherit")));
            this.dtmBLDate.PostValidation.Inherit = ((C1.Win.C1Input.PostValidationInheritFlags)(resources.GetObject("dtmBLDate.PostValidation.Inherit")));
            this.dtmBLDate.PostValidation.Validation = ((C1.Win.C1Input.PostValidationTypeEnum)(resources.GetObject("dtmBLDate.PostValidation.Validation")));
            this.dtmBLDate.PreValidation.Inherit = ((C1.Win.C1Input.PreValidationInheritFlags)(resources.GetObject("dtmBLDate.PreValidation.Inherit")));
            this.dtmBLDate.PreValidation.ItemSeparator = resources.GetString("dtmBLDate.PreValidation.ItemSeparator");
            this.dtmBLDate.PreValidation.PatternString = resources.GetString("dtmBLDate.PreValidation.PatternString");
            this.dtmBLDate.PreValidation.RegexOptions = ((C1.Win.C1Input.RegexOptionFlags)(resources.GetObject("dtmBLDate.PreValidation.RegexOptions")));
            this.dtmBLDate.PreValidation.Validation = ((C1.Win.C1Input.PreValidationTypeEnum)(resources.GetObject("dtmBLDate.PreValidation.Validation")));
            this.dtmBLDate.Tag = null;
            // 
            // lblBLDate
            // 
            this.lblBLDate.AccessibleDescription = null;
            this.lblBLDate.AccessibleName = null;
            resources.ApplyResources(this.lblBLDate, "lblBLDate");
            this.lblBLDate.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.lblBLDate.Font = null;
            this.lblBLDate.ForeColor = System.Drawing.SystemColors.ControlText;
            this.lblBLDate.Name = "lblBLDate";
            // 
            // txtTaxInformNo
            // 
            this.txtTaxInformNo.AccessibleDescription = null;
            this.txtTaxInformNo.AccessibleName = null;
            resources.ApplyResources(this.txtTaxInformNo, "txtTaxInformNo");
            this.txtTaxInformNo.BackgroundImage = null;
            this.txtTaxInformNo.Font = null;
            this.txtTaxInformNo.Name = "txtTaxInformNo";
            // 
            // lblTaxInformNo
            // 
            this.lblTaxInformNo.AccessibleDescription = null;
            this.lblTaxInformNo.AccessibleName = null;
            resources.ApplyResources(this.lblTaxInformNo, "lblTaxInformNo");
            this.lblTaxInformNo.Font = null;
            this.lblTaxInformNo.ForeColor = System.Drawing.Color.Black;
            this.lblTaxInformNo.Name = "lblTaxInformNo";
            // 
            // txtDeclaredNo
            // 
            this.txtDeclaredNo.AccessibleDescription = null;
            this.txtDeclaredNo.AccessibleName = null;
            resources.ApplyResources(this.txtDeclaredNo, "txtDeclaredNo");
            this.txtDeclaredNo.BackgroundImage = null;
            this.txtDeclaredNo.Font = null;
            this.txtDeclaredNo.Name = "txtDeclaredNo";
            // 
            // lblTaxDeclareNo
            // 
            this.lblTaxDeclareNo.AccessibleDescription = null;
            this.lblTaxDeclareNo.AccessibleName = null;
            resources.ApplyResources(this.lblTaxDeclareNo, "lblTaxDeclareNo");
            this.lblTaxDeclareNo.Font = null;
            this.lblTaxDeclareNo.ForeColor = System.Drawing.Color.Black;
            this.lblTaxDeclareNo.Name = "lblTaxDeclareNo";
            // 
            // dtmInformDate
            // 
            resources.ApplyResources(this.dtmInformDate, "dtmInformDate");
            this.dtmInformDate.AccessibleDescription = null;
            this.dtmInformDate.AccessibleName = null;
            this.dtmInformDate.BackgroundImage = null;
            // 
            // 
            // 
            this.dtmInformDate.Calendar.AccessibleDescription = null;
            this.dtmInformDate.Calendar.AccessibleName = null;
            this.dtmInformDate.Calendar.BackgroundImage = null;
            this.dtmInformDate.Calendar.BackgroundImageLayout = ((System.Windows.Forms.ImageLayout)(resources.GetObject("dtmInformDate.Calendar.BackgroundImageLayout")));
            this.dtmInformDate.Calendar.FirstDayOfWeek = ((System.Windows.Forms.Day)(resources.GetObject("dtmInformDate.Calendar.FirstDayOfWeek")));
            this.dtmInformDate.Calendar.Font = null;
            this.dtmInformDate.Calendar.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("dtmInformDate.Calendar.ImeMode")));
            this.dtmInformDate.Calendar.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("dtmInformDate.Calendar.RightToLeft")));
            this.dtmInformDate.Calendar.RightToLeftLayout = ((bool)(resources.GetObject("dtmInformDate.Calendar.RightToLeftLayout")));
            this.dtmInformDate.Calendar.ShowClearButton = ((bool)(resources.GetObject("dtmInformDate.Calendar.ShowClearButton")));
            this.dtmInformDate.Calendar.ShowTodayButton = ((bool)(resources.GetObject("dtmInformDate.Calendar.ShowTodayButton")));
            this.dtmInformDate.Calendar.ShowWeekNumbers = ((bool)(resources.GetObject("dtmInformDate.Calendar.ShowWeekNumbers")));
            this.dtmInformDate.DisplayFormat.Inherit = ((C1.Win.C1Input.FormatInfoInheritFlags)(resources.GetObject("dtmInformDate.DisplayFormat.Inherit")));
            this.dtmInformDate.EditFormat.Inherit = ((C1.Win.C1Input.FormatInfoInheritFlags)(resources.GetObject("dtmInformDate.EditFormat.Inherit")));
            this.dtmInformDate.EditMask = null;
            this.dtmInformDate.ErrorInfo.BeepOnError = ((bool)(resources.GetObject("dtmInformDate.ErrorInfo.BeepOnError")));
            this.dtmInformDate.ErrorInfo.ErrorMessage = resources.GetString("dtmInformDate.ErrorInfo.ErrorMessage");
            this.dtmInformDate.ErrorInfo.ErrorMessageCaption = resources.GetString("dtmInformDate.ErrorInfo.ErrorMessageCaption");
            this.dtmInformDate.ErrorInfo.ShowErrorMessage = ((bool)(resources.GetObject("dtmInformDate.ErrorInfo.ShowErrorMessage")));
            this.dtmInformDate.Font = null;
            this.dtmInformDate.MaskInfo.AutoTabWhenFilled = ((bool)(resources.GetObject("dtmInformDate.MaskInfo.AutoTabWhenFilled")));
            this.dtmInformDate.MaskInfo.Inherit = ((C1.Win.C1Input.MaskInfoInheritFlags)(resources.GetObject("dtmInformDate.MaskInfo.Inherit")));
            this.dtmInformDate.MaskInfo.PromptChar = ((char)(resources.GetObject("dtmInformDate.MaskInfo.PromptChar")));
            this.dtmInformDate.MaskInfo.ShowLiterals = ((C1.Win.C1Input.ShowLiteralsEnum)(resources.GetObject("dtmInformDate.MaskInfo.ShowLiterals")));
            this.dtmInformDate.MaskInfo.StoredEmptyChar = ((char)(resources.GetObject("dtmInformDate.MaskInfo.StoredEmptyChar")));
            this.dtmInformDate.Name = "dtmInformDate";
            this.dtmInformDate.ParseInfo.DateTimeStyle = ((C1.Win.C1Input.DateTimeStyleFlags)(resources.GetObject("dtmInformDate.ParseInfo.DateTimeStyle")));
            this.dtmInformDate.ParseInfo.Inherit = ((C1.Win.C1Input.ParseInfoInheritFlags)(resources.GetObject("dtmInformDate.ParseInfo.Inherit")));
            this.dtmInformDate.PostValidation.Inherit = ((C1.Win.C1Input.PostValidationInheritFlags)(resources.GetObject("dtmInformDate.PostValidation.Inherit")));
            this.dtmInformDate.PostValidation.Validation = ((C1.Win.C1Input.PostValidationTypeEnum)(resources.GetObject("dtmInformDate.PostValidation.Validation")));
            this.dtmInformDate.PreValidation.Inherit = ((C1.Win.C1Input.PreValidationInheritFlags)(resources.GetObject("dtmInformDate.PreValidation.Inherit")));
            this.dtmInformDate.PreValidation.ItemSeparator = resources.GetString("dtmInformDate.PreValidation.ItemSeparator");
            this.dtmInformDate.PreValidation.PatternString = resources.GetString("dtmInformDate.PreValidation.PatternString");
            this.dtmInformDate.PreValidation.RegexOptions = ((C1.Win.C1Input.RegexOptionFlags)(resources.GetObject("dtmInformDate.PreValidation.RegexOptions")));
            this.dtmInformDate.PreValidation.Validation = ((C1.Win.C1Input.PreValidationTypeEnum)(resources.GetObject("dtmInformDate.PreValidation.Validation")));
            this.dtmInformDate.Tag = null;
            // 
            // lblInformDate
            // 
            this.lblInformDate.AccessibleDescription = null;
            this.lblInformDate.AccessibleName = null;
            resources.ApplyResources(this.lblInformDate, "lblInformDate");
            this.lblInformDate.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.lblInformDate.Font = null;
            this.lblInformDate.ForeColor = System.Drawing.SystemColors.ControlText;
            this.lblInformDate.Name = "lblInformDate";
            // 
            // dtmDeclareDate
            // 
            resources.ApplyResources(this.dtmDeclareDate, "dtmDeclareDate");
            this.dtmDeclareDate.AccessibleDescription = null;
            this.dtmDeclareDate.AccessibleName = null;
            this.dtmDeclareDate.BackgroundImage = null;
            // 
            // 
            // 
            this.dtmDeclareDate.Calendar.AccessibleDescription = null;
            this.dtmDeclareDate.Calendar.AccessibleName = null;
            this.dtmDeclareDate.Calendar.BackgroundImage = null;
            this.dtmDeclareDate.Calendar.BackgroundImageLayout = ((System.Windows.Forms.ImageLayout)(resources.GetObject("dtmDeclareDate.Calendar.BackgroundImageLayout")));
            this.dtmDeclareDate.Calendar.FirstDayOfWeek = ((System.Windows.Forms.Day)(resources.GetObject("dtmDeclareDate.Calendar.FirstDayOfWeek")));
            this.dtmDeclareDate.Calendar.Font = null;
            this.dtmDeclareDate.Calendar.ImeMode = ((System.Windows.Forms.ImeMode)(resources.GetObject("dtmDeclareDate.Calendar.ImeMode")));
            this.dtmDeclareDate.Calendar.RightToLeft = ((System.Windows.Forms.RightToLeft)(resources.GetObject("dtmDeclareDate.Calendar.RightToLeft")));
            this.dtmDeclareDate.Calendar.RightToLeftLayout = ((bool)(resources.GetObject("dtmDeclareDate.Calendar.RightToLeftLayout")));
            this.dtmDeclareDate.Calendar.ShowClearButton = ((bool)(resources.GetObject("dtmDeclareDate.Calendar.ShowClearButton")));
            this.dtmDeclareDate.Calendar.ShowTodayButton = ((bool)(resources.GetObject("dtmDeclareDate.Calendar.ShowTodayButton")));
            this.dtmDeclareDate.Calendar.ShowWeekNumbers = ((bool)(resources.GetObject("dtmDeclareDate.Calendar.ShowWeekNumbers")));
            this.dtmDeclareDate.DisplayFormat.Inherit = ((C1.Win.C1Input.FormatInfoInheritFlags)(resources.GetObject("dtmDeclareDate.DisplayFormat.Inherit")));
            this.dtmDeclareDate.EditFormat.Inherit = ((C1.Win.C1Input.FormatInfoInheritFlags)(resources.GetObject("dtmDeclareDate.EditFormat.Inherit")));
            this.dtmDeclareDate.EditMask = null;
            this.dtmDeclareDate.ErrorInfo.BeepOnError = ((bool)(resources.GetObject("dtmDeclareDate.ErrorInfo.BeepOnError")));
            this.dtmDeclareDate.ErrorInfo.ErrorMessage = resources.GetString("dtmDeclareDate.ErrorInfo.ErrorMessage");
            this.dtmDeclareDate.ErrorInfo.ErrorMessageCaption = resources.GetString("dtmDeclareDate.ErrorInfo.ErrorMessageCaption");
            this.dtmDeclareDate.ErrorInfo.ShowErrorMessage = ((bool)(resources.GetObject("dtmDeclareDate.ErrorInfo.ShowErrorMessage")));
            this.dtmDeclareDate.Font = null;
            this.dtmDeclareDate.MaskInfo.AutoTabWhenFilled = ((bool)(resources.GetObject("dtmDeclareDate.MaskInfo.AutoTabWhenFilled")));
            this.dtmDeclareDate.MaskInfo.Inherit = ((C1.Win.C1Input.MaskInfoInheritFlags)(resources.GetObject("dtmDeclareDate.MaskInfo.Inherit")));
            this.dtmDeclareDate.MaskInfo.PromptChar = ((char)(resources.GetObject("dtmDeclareDate.MaskInfo.PromptChar")));
            this.dtmDeclareDate.MaskInfo.ShowLiterals = ((C1.Win.C1Input.ShowLiteralsEnum)(resources.GetObject("dtmDeclareDate.MaskInfo.ShowLiterals")));
            this.dtmDeclareDate.MaskInfo.StoredEmptyChar = ((char)(resources.GetObject("dtmDeclareDate.MaskInfo.StoredEmptyChar")));
            this.dtmDeclareDate.Name = "dtmDeclareDate";
            this.dtmDeclareDate.ParseInfo.DateTimeStyle = ((C1.Win.C1Input.DateTimeStyleFlags)(resources.GetObject("dtmDeclareDate.ParseInfo.DateTimeStyle")));
            this.dtmDeclareDate.ParseInfo.Inherit = ((C1.Win.C1Input.ParseInfoInheritFlags)(resources.GetObject("dtmDeclareDate.ParseInfo.Inherit")));
            this.dtmDeclareDate.PostValidation.Inherit = ((C1.Win.C1Input.PostValidationInheritFlags)(resources.GetObject("dtmDeclareDate.PostValidation.Inherit")));
            this.dtmDeclareDate.PostValidation.Validation = ((C1.Win.C1Input.PostValidationTypeEnum)(resources.GetObject("dtmDeclareDate.PostValidation.Validation")));
            this.dtmDeclareDate.PreValidation.Inherit = ((C1.Win.C1Input.PreValidationInheritFlags)(resources.GetObject("dtmDeclareDate.PreValidation.Inherit")));
            this.dtmDeclareDate.PreValidation.ItemSeparator = resources.GetString("dtmDeclareDate.PreValidation.ItemSeparator");
            this.dtmDeclareDate.PreValidation.PatternString = resources.GetString("dtmDeclareDate.PreValidation.PatternString");
            this.dtmDeclareDate.PreValidation.RegexOptions = ((C1.Win.C1Input.RegexOptionFlags)(resources.GetObject("dtmDeclareDate.PreValidation.RegexOptions")));
            this.dtmDeclareDate.PreValidation.Validation = ((C1.Win.C1Input.PreValidationTypeEnum)(resources.GetObject("dtmDeclareDate.PreValidation.Validation")));
            this.dtmDeclareDate.Tag = null;
            // 
            // lblDeclareDate
            // 
            this.lblDeclareDate.AccessibleDescription = null;
            this.lblDeclareDate.AccessibleName = null;
            resources.ApplyResources(this.lblDeclareDate, "lblDeclareDate");
            this.lblDeclareDate.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.lblDeclareDate.Font = null;
            this.lblDeclareDate.ForeColor = System.Drawing.SystemColors.ControlText;
            this.lblDeclareDate.Name = "lblDeclareDate";
            // 
            // numTotalCIPAmt
            // 
            resources.ApplyResources(this.numTotalCIPAmt, "numTotalCIPAmt");
            this.numTotalCIPAmt.AccessibleDescription = null;
            this.numTotalCIPAmt.AccessibleName = null;
            this.numTotalCIPAmt.BackgroundImage = null;
            // 
            // 
            // 
            this.numTotalCIPAmt.Calculator.AccessibleDescription = null;
            this.numTotalCIPAmt.Calculator.AccessibleName = null;
            this.numTotalCIPAmt.Calculator.BackgroundImage = null;
            this.numTotalCIPAmt.Calculator.BackgroundImageLayout = ((System.Windows.Forms.ImageLayout)(resources.GetObject("numTotalCIPAmt.Calculator.BackgroundImageLayout")));
            this.numTotalCIPAmt.Calculator.ButtonFlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("numTotalCIPAmt.Calculator.ButtonFlatStyle")));
            this.numTotalCIPAmt.Calculator.DisplayFormat = resources.GetString("numTotalCIPAmt.Calculator.DisplayFormat");
            this.numTotalCIPAmt.Calculator.Font = null;
            this.numTotalCIPAmt.Calculator.FormatOnClose = ((bool)(resources.GetObject("numTotalCIPAmt.Calculator.FormatOnClose")));
            this.numTotalCIPAmt.Calculator.StoredFormat = resources.GetString("numTotalCIPAmt.Calculator.StoredFormat");
            this.numTotalCIPAmt.Calculator.UIStrings.Content = ((string[])(resources.GetObject("numTotalCIPAmt.Calculator.UIStrings.Content")));
            this.numTotalCIPAmt.DisplayFormat.Inherit = ((C1.Win.C1Input.FormatInfoInheritFlags)(resources.GetObject("numTotalCIPAmt.DisplayFormat.Inherit")));
            this.numTotalCIPAmt.EditFormat.Inherit = ((C1.Win.C1Input.FormatInfoInheritFlags)(resources.GetObject("numTotalCIPAmt.EditFormat.Inherit")));
            this.numTotalCIPAmt.EditMask = null;
            this.numTotalCIPAmt.ErrorInfo.BeepOnError = ((bool)(resources.GetObject("numTotalCIPAmt.ErrorInfo.BeepOnError")));
            this.numTotalCIPAmt.ErrorInfo.ErrorMessage = resources.GetString("numTotalCIPAmt.ErrorInfo.ErrorMessage");
            this.numTotalCIPAmt.ErrorInfo.ErrorMessageCaption = resources.GetString("numTotalCIPAmt.ErrorInfo.ErrorMessageCaption");
            this.numTotalCIPAmt.ErrorInfo.ShowErrorMessage = ((bool)(resources.GetObject("numTotalCIPAmt.ErrorInfo.ShowErrorMessage")));
            this.numTotalCIPAmt.Font = null;
            this.numTotalCIPAmt.MaskInfo.AutoTabWhenFilled = ((bool)(resources.GetObject("numTotalCIPAmt.MaskInfo.AutoTabWhenFilled")));
            this.numTotalCIPAmt.MaskInfo.Inherit = ((C1.Win.C1Input.MaskInfoInheritFlags)(resources.GetObject("numTotalCIPAmt.MaskInfo.Inherit")));
            this.numTotalCIPAmt.MaskInfo.PromptChar = ((char)(resources.GetObject("numTotalCIPAmt.MaskInfo.PromptChar")));
            this.numTotalCIPAmt.MaskInfo.ShowLiterals = ((C1.Win.C1Input.ShowLiteralsEnum)(resources.GetObject("numTotalCIPAmt.MaskInfo.ShowLiterals")));
            this.numTotalCIPAmt.MaskInfo.StoredEmptyChar = ((char)(resources.GetObject("numTotalCIPAmt.MaskInfo.StoredEmptyChar")));
            this.numTotalCIPAmt.Name = "numTotalCIPAmt";
            this.numTotalCIPAmt.ParseInfo.Inherit = ((C1.Win.C1Input.ParseInfoInheritFlags)(resources.GetObject("numTotalCIPAmt.ParseInfo.Inherit")));
            this.numTotalCIPAmt.ParseInfo.NumberStyle = ((C1.Win.C1Input.NumberStyleFlags)(resources.GetObject("numTotalCIPAmt.ParseInfo.NumberStyle")));
            this.numTotalCIPAmt.PostValidation.Inherit = ((C1.Win.C1Input.PostValidationInheritFlags)(resources.GetObject("numTotalCIPAmt.PostValidation.Inherit")));
            this.numTotalCIPAmt.PostValidation.Validation = ((C1.Win.C1Input.PostValidationTypeEnum)(resources.GetObject("numTotalCIPAmt.PostValidation.Validation")));
            this.numTotalCIPAmt.PreValidation.Inherit = ((C1.Win.C1Input.PreValidationInheritFlags)(resources.GetObject("numTotalCIPAmt.PreValidation.Inherit")));
            this.numTotalCIPAmt.PreValidation.ItemSeparator = resources.GetString("numTotalCIPAmt.PreValidation.ItemSeparator");
            this.numTotalCIPAmt.PreValidation.PatternString = resources.GetString("numTotalCIPAmt.PreValidation.PatternString");
            this.numTotalCIPAmt.PreValidation.RegexOptions = ((C1.Win.C1Input.RegexOptionFlags)(resources.GetObject("numTotalCIPAmt.PreValidation.RegexOptions")));
            this.numTotalCIPAmt.PreValidation.Validation = ((C1.Win.C1Input.PreValidationTypeEnum)(resources.GetObject("numTotalCIPAmt.PreValidation.Validation")));
            this.numTotalCIPAmt.ReadOnly = true;
            this.numTotalCIPAmt.TabStop = false;
            this.numTotalCIPAmt.Tag = null;
            // 
            // numTotalInlandAmt
            // 
            resources.ApplyResources(this.numTotalInlandAmt, "numTotalInlandAmt");
            this.numTotalInlandAmt.AccessibleDescription = null;
            this.numTotalInlandAmt.AccessibleName = null;
            this.numTotalInlandAmt.BackgroundImage = null;
            // 
            // 
            // 
            this.numTotalInlandAmt.Calculator.AccessibleDescription = null;
            this.numTotalInlandAmt.Calculator.AccessibleName = null;
            this.numTotalInlandAmt.Calculator.BackgroundImage = null;
            this.numTotalInlandAmt.Calculator.BackgroundImageLayout = ((System.Windows.Forms.ImageLayout)(resources.GetObject("numTotalInlandAmt.Calculator.BackgroundImageLayout")));
            this.numTotalInlandAmt.Calculator.ButtonFlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("numTotalInlandAmt.Calculator.ButtonFlatStyle")));
            this.numTotalInlandAmt.Calculator.DisplayFormat = resources.GetString("numTotalInlandAmt.Calculator.DisplayFormat");
            this.numTotalInlandAmt.Calculator.Font = null;
            this.numTotalInlandAmt.Calculator.FormatOnClose = ((bool)(resources.GetObject("numTotalInlandAmt.Calculator.FormatOnClose")));
            this.numTotalInlandAmt.Calculator.StoredFormat = resources.GetString("numTotalInlandAmt.Calculator.StoredFormat");
            this.numTotalInlandAmt.Calculator.UIStrings.Content = ((string[])(resources.GetObject("numTotalInlandAmt.Calculator.UIStrings.Content")));
            this.numTotalInlandAmt.DisplayFormat.Inherit = ((C1.Win.C1Input.FormatInfoInheritFlags)(resources.GetObject("numTotalInlandAmt.DisplayFormat.Inherit")));
            this.numTotalInlandAmt.EditFormat.Inherit = ((C1.Win.C1Input.FormatInfoInheritFlags)(resources.GetObject("numTotalInlandAmt.EditFormat.Inherit")));
            this.numTotalInlandAmt.EditMask = null;
            this.numTotalInlandAmt.ErrorInfo.BeepOnError = ((bool)(resources.GetObject("numTotalInlandAmt.ErrorInfo.BeepOnError")));
            this.numTotalInlandAmt.ErrorInfo.ErrorMessage = resources.GetString("numTotalInlandAmt.ErrorInfo.ErrorMessage");
            this.numTotalInlandAmt.ErrorInfo.ErrorMessageCaption = resources.GetString("numTotalInlandAmt.ErrorInfo.ErrorMessageCaption");
            this.numTotalInlandAmt.ErrorInfo.ShowErrorMessage = ((bool)(resources.GetObject("numTotalInlandAmt.ErrorInfo.ShowErrorMessage")));
            this.numTotalInlandAmt.Font = null;
            this.numTotalInlandAmt.MaskInfo.AutoTabWhenFilled = ((bool)(resources.GetObject("numTotalInlandAmt.MaskInfo.AutoTabWhenFilled")));
            this.numTotalInlandAmt.MaskInfo.Inherit = ((C1.Win.C1Input.MaskInfoInheritFlags)(resources.GetObject("numTotalInlandAmt.MaskInfo.Inherit")));
            this.numTotalInlandAmt.MaskInfo.PromptChar = ((char)(resources.GetObject("numTotalInlandAmt.MaskInfo.PromptChar")));
            this.numTotalInlandAmt.MaskInfo.ShowLiterals = ((C1.Win.C1Input.ShowLiteralsEnum)(resources.GetObject("numTotalInlandAmt.MaskInfo.ShowLiterals")));
            this.numTotalInlandAmt.MaskInfo.StoredEmptyChar = ((char)(resources.GetObject("numTotalInlandAmt.MaskInfo.StoredEmptyChar")));
            this.numTotalInlandAmt.Name = "numTotalInlandAmt";
            this.numTotalInlandAmt.ParseInfo.Inherit = ((C1.Win.C1Input.ParseInfoInheritFlags)(resources.GetObject("numTotalInlandAmt.ParseInfo.Inherit")));
            this.numTotalInlandAmt.ParseInfo.NumberStyle = ((C1.Win.C1Input.NumberStyleFlags)(resources.GetObject("numTotalInlandAmt.ParseInfo.NumberStyle")));
            this.numTotalInlandAmt.PostValidation.Inherit = ((C1.Win.C1Input.PostValidationInheritFlags)(resources.GetObject("numTotalInlandAmt.PostValidation.Inherit")));
            this.numTotalInlandAmt.PostValidation.Validation = ((C1.Win.C1Input.PostValidationTypeEnum)(resources.GetObject("numTotalInlandAmt.PostValidation.Validation")));
            this.numTotalInlandAmt.PreValidation.Inherit = ((C1.Win.C1Input.PreValidationInheritFlags)(resources.GetObject("numTotalInlandAmt.PreValidation.Inherit")));
            this.numTotalInlandAmt.PreValidation.ItemSeparator = resources.GetString("numTotalInlandAmt.PreValidation.ItemSeparator");
            this.numTotalInlandAmt.PreValidation.PatternString = resources.GetString("numTotalInlandAmt.PreValidation.PatternString");
            this.numTotalInlandAmt.PreValidation.RegexOptions = ((C1.Win.C1Input.RegexOptionFlags)(resources.GetObject("numTotalInlandAmt.PreValidation.RegexOptions")));
            this.numTotalInlandAmt.PreValidation.Validation = ((C1.Win.C1Input.PreValidationTypeEnum)(resources.GetObject("numTotalInlandAmt.PreValidation.Validation")));
            this.numTotalInlandAmt.ReadOnly = true;
            this.numTotalInlandAmt.TabStop = false;
            this.numTotalInlandAmt.Tag = null;
            // 
            // lblTotalCIPAmt
            // 
            this.lblTotalCIPAmt.AccessibleDescription = null;
            this.lblTotalCIPAmt.AccessibleName = null;
            resources.ApplyResources(this.lblTotalCIPAmt, "lblTotalCIPAmt");
            this.lblTotalCIPAmt.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.lblTotalCIPAmt.Font = null;
            this.lblTotalCIPAmt.Name = "lblTotalCIPAmt";
            // 
            // lblTotalInlandAmt
            // 
            this.lblTotalInlandAmt.AccessibleDescription = null;
            this.lblTotalInlandAmt.AccessibleName = null;
            resources.ApplyResources(this.lblTotalInlandAmt, "lblTotalInlandAmt");
            this.lblTotalInlandAmt.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
            this.lblTotalInlandAmt.Font = null;
            this.lblTotalInlandAmt.Name = "lblTotalInlandAmt";
            // 
            // txtBLNo
            // 
            this.txtBLNo.AccessibleDescription = null;
            this.txtBLNo.AccessibleName = null;
            resources.ApplyResources(this.txtBLNo, "txtBLNo");
            this.txtBLNo.BackgroundImage = null;
            this.txtBLNo.Font = null;
            this.txtBLNo.Name = "txtBLNo";
            // 
            // lblBLNo
            // 
            this.lblBLNo.AccessibleDescription = null;
            this.lblBLNo.AccessibleName = null;
            resources.ApplyResources(this.lblBLNo, "lblBLNo");
            this.lblBLNo.Font = null;
            this.lblBLNo.ForeColor = System.Drawing.Color.Black;
            this.lblBLNo.Name = "lblBLNo";
            // 
            // numValue
            // 
            resources.ApplyResources(this.numValue, "numValue");
            this.numValue.AccessibleDescription = null;
            this.numValue.AccessibleName = null;
            this.numValue.BackgroundImage = null;
            // 
            // 
            // 
            this.numValue.Calculator.AccessibleDescription = null;
            this.numValue.Calculator.AccessibleName = null;
            this.numValue.Calculator.BackgroundImage = null;
            this.numValue.Calculator.BackgroundImageLayout = ((System.Windows.Forms.ImageLayout)(resources.GetObject("numValue.Calculator.BackgroundImageLayout")));
            this.numValue.Calculator.ButtonFlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("numValue.Calculator.ButtonFlatStyle")));
            this.numValue.Calculator.DisplayFormat = resources.GetString("numValue.Calculator.DisplayFormat");
            this.numValue.Calculator.Font = null;
            this.numValue.Calculator.FormatOnClose = ((bool)(resources.GetObject("numValue.Calculator.FormatOnClose")));
            this.numValue.Calculator.StoredFormat = resources.GetString("numValue.Calculator.StoredFormat");
            this.numValue.Calculator.UIStrings.Content = ((string[])(resources.GetObject("numValue.Calculator.UIStrings.Content")));
            this.numValue.DisplayFormat.Inherit = ((C1.Win.C1Input.FormatInfoInheritFlags)(resources.GetObject("numValue.DisplayFormat.Inherit")));
            this.numValue.EditFormat.Inherit = ((C1.Win.C1Input.FormatInfoInheritFlags)(resources.GetObject("numValue.EditFormat.Inherit")));
            this.numValue.EditMask = null;
            this.numValue.ErrorInfo.BeepOnError = ((bool)(resources.GetObject("numValue.ErrorInfo.BeepOnError")));
            this.numValue.ErrorInfo.ErrorMessage = resources.GetString("numValue.ErrorInfo.ErrorMessage");
            this.numValue.ErrorInfo.ErrorMessageCaption = resources.GetString("numValue.ErrorInfo.ErrorMessageCaption");
            this.numValue.ErrorInfo.ShowErrorMessage = ((bool)(resources.GetObject("numValue.ErrorInfo.ShowErrorMessage")));
            this.numValue.Font = null;
            this.numValue.MaskInfo.AutoTabWhenFilled = ((bool)(resources.GetObject("numValue.MaskInfo.AutoTabWhenFilled")));
            this.numValue.MaskInfo.Inherit = ((C1.Win.C1Input.MaskInfoInheritFlags)(resources.GetObject("numValue.MaskInfo.Inherit")));
            this.numValue.MaskInfo.PromptChar = ((char)(resources.GetObject("numValue.MaskInfo.PromptChar")));
            this.numValue.MaskInfo.ShowLiterals = ((C1.Win.C1Input.ShowLiteralsEnum)(resources.GetObject("numValue.MaskInfo.ShowLiterals")));
            this.numValue.MaskInfo.StoredEmptyChar = ((char)(resources.GetObject("numValue.MaskInfo.StoredEmptyChar")));
            this.numValue.Name = "numValue";
            this.numValue.NumericInputKeys = ((C1.Win.C1Input.NumericInputKeyFlags)((((C1.Win.C1Input.NumericInputKeyFlags.F9 | C1.Win.C1Input.NumericInputKeyFlags.Plus)
                        | C1.Win.C1Input.NumericInputKeyFlags.Decimal)
                        | C1.Win.C1Input.NumericInputKeyFlags.X)));
            this.numValue.ParseInfo.Inherit = ((C1.Win.C1Input.ParseInfoInheritFlags)(resources.GetObject("numValue.ParseInfo.Inherit")));
            this.numValue.ParseInfo.NumberStyle = ((C1.Win.C1Input.NumberStyleFlags)(resources.GetObject("numValue.ParseInfo.NumberStyle")));
            this.numValue.PostValidation.Inherit = ((C1.Win.C1Input.PostValidationInheritFlags)(resources.GetObject("numValue.PostValidation.Inherit")));
            this.numValue.PostValidation.Validation = ((C1.Win.C1Input.PostValidationTypeEnum)(resources.GetObject("numValue.PostValidation.Validation")));
            this.numValue.PreValidation.Inherit = ((C1.Win.C1Input.PreValidationInheritFlags)(resources.GetObject("numValue.PreValidation.Inherit")));
            this.numValue.PreValidation.ItemSeparator = resources.GetString("numValue.PreValidation.ItemSeparator");
            this.numValue.PreValidation.PatternString = resources.GetString("numValue.PreValidation.PatternString");
            this.numValue.PreValidation.RegexOptions = ((C1.Win.C1Input.RegexOptionFlags)(resources.GetObject("numValue.PreValidation.RegexOptions")));
            this.numValue.PreValidation.Validation = ((C1.Win.C1Input.PreValidationTypeEnum)(resources.GetObject("numValue.PreValidation.Validation")));
            this.numValue.Tag = null;
            // 
            // lblInputTotalInland
            // 
            this.lblInputTotalInland.AccessibleDescription = null;
            this.lblInputTotalInland.AccessibleName = null;
            resources.ApplyResources(this.lblInputTotalInland, "lblInputTotalInland");
            this.lblInputTotalInland.Font = null;
            this.lblInputTotalInland.Name = "lblInputTotalInland";
            // 
            // lblPOApprovalDate
            // 
            this.lblPOApprovalDate.AccessibleDescription = null;
            this.lblPOApprovalDate.AccessibleName = null;
            resources.ApplyResources(this.lblPOApprovalDate, "lblPOApprovalDate");
            this.lblPOApprovalDate.Font = null;
            this.lblPOApprovalDate.Name = "lblPOApprovalDate";
            // 
            // btnPrintConfiguration
            // 
            this.btnPrintConfiguration.AccessibleDescription = null;
            this.btnPrintConfiguration.AccessibleName = null;
            resources.ApplyResources(this.btnPrintConfiguration, "btnPrintConfiguration");
            this.btnPrintConfiguration.BackgroundImage = null;
            this.btnPrintConfiguration.Name = "btnPrintConfiguration";
            // 
            // lblVATTaxRate
            // 
            this.lblVATTaxRate.AccessibleDescription = null;
            this.lblVATTaxRate.AccessibleName = null;
            resources.ApplyResources(this.lblVATTaxRate, "lblVATTaxRate");
            this.lblVATTaxRate.Font = null;
            this.lblVATTaxRate.Name = "lblVATTaxRate";
            // 
            // lblImportTaxRate
            // 
            this.lblImportTaxRate.AccessibleDescription = null;
            this.lblImportTaxRate.AccessibleName = null;
            resources.ApplyResources(this.lblImportTaxRate, "lblImportTaxRate");
            this.lblImportTaxRate.Font = null;
            this.lblImportTaxRate.Name = "lblImportTaxRate";
            // 
            // numQuantity
            // 
            resources.ApplyResources(this.numQuantity, "numQuantity");
            this.numQuantity.AccessibleDescription = null;
            this.numQuantity.AccessibleName = null;
            this.numQuantity.BackgroundImage = null;
            // 
            // 
            // 
            this.numQuantity.Calculator.AccessibleDescription = null;
            this.numQuantity.Calculator.AccessibleName = null;
            this.numQuantity.Calculator.BackgroundImage = null;
            this.numQuantity.Calculator.BackgroundImageLayout = ((System.Windows.Forms.ImageLayout)(resources.GetObject("numQuantity.Calculator.BackgroundImageLayout")));
            this.numQuantity.Calculator.ButtonFlatStyle = ((System.Windows.Forms.FlatStyle)(resources.GetObject("numQuantity.Calculator.ButtonFlatStyle")));
            this.numQuantity.Calculator.DisplayFormat = resources.GetString("numQuantity.Calculator.DisplayFormat");
            this.numQuantity.Calculator.Font = null;
            this.numQuantity.Calculator.FormatOnClose = ((bool)(resources.GetObject("numQuantity.Calculator.FormatOnClose")));
            this.numQuantity.Calculator.StoredFormat = resources.GetString("numQuantity.Calculator.StoredFormat");
            this.numQuantity.Calculator.UIStrings.Content = ((string[])(resources.GetObject("numQuantity.Calculator.UIStrings.Content")));
            this.numQuantity.DisplayFormat.Inherit = ((C1.Win.C1Input.FormatInfoInheritFlags)(resources.GetObject("numQuantity.DisplayFormat.Inherit")));
            this.numQuantity.EditFormat.Inherit = ((C1.Win.C1Input.FormatInfoInheritFlags)(resources.GetObject("numQuantity.EditFormat.Inherit")));
            this.numQuantity.EditMask = null;
            this.numQuantity.ErrorInfo.BeepOnError = ((bool)(resources.GetObject("numQuantity.ErrorInfo.BeepOnError")));
            this.numQuantity.ErrorInfo.ErrorMessage = resources.GetString("numQuantity.ErrorInfo.ErrorMessage");
            this.numQuantity.ErrorInfo.ErrorMessageCaption = resources.GetString("numQuantity.ErrorInfo.ErrorMessageCaption");
            this.numQuantity.ErrorInfo.ShowErrorMessage = ((bool)(resources.GetObject("numQuantity.ErrorInfo.ShowErrorMessage")));
            this.numQuantity.Font = null;
            this.numQuantity.MaskInfo.AutoTabWhenFilled = ((bool)(resources.GetObject("numQuantity.MaskInfo.AutoTabWhenFilled")));
            this.numQuantity.MaskInfo.Inherit = ((C1.Win.C1Input.MaskInfoInheritFlags)(resources.GetObject("numQuantity.MaskInfo.Inherit")));
            this.numQuantity.MaskInfo.PromptChar = ((char)(resources.GetObject("numQuantity.MaskInfo.PromptChar")));
            this.numQuantity.MaskInfo.ShowLiterals = ((C1.Win.C1Input.ShowLiteralsEnum)(resources.GetObject("numQuantity.MaskInfo.ShowLiterals")));
            this.numQuantity.MaskInfo.StoredEmptyChar = ((char)(resources.GetObject("numQuantity.MaskInfo.StoredEmptyChar")));
            this.numQuantity.Name = "numQuantity";
            this.numQuantity.NumericInputKeys = ((C1.Win.C1Input.NumericInputKeyFlags)((((C1.Win.C1Input.NumericInputKeyFlags.F9 | C1.Win.C1Input.NumericInputKeyFlags.Plus)
                        | C1.Win.C1Input.NumericInputKeyFlags.Decimal)
                        | C1.Win.C1Input.NumericInputKeyFlags.X)));
            this.numQuantity.ParseInfo.Inherit = ((C1.Win.C1Input.ParseInfoInheritFlags)(resources.GetObject("numQuantity.ParseInfo.Inherit")));
            this.numQuantity.ParseInfo.NumberStyle = ((C1.Win.C1Input.NumberStyleFlags)(resources.GetObject("numQuantity.ParseInfo.NumberStyle")));
            this.numQuantity.PostValidation.Inherit = ((C1.Win.C1Input.PostValidationInheritFlags)(resources.GetObject("numQuantity.PostValidation.Inherit")));
            this.numQuantity.PostValidation.Validation = ((C1.Win.C1Input.PostValidationTypeEnum)(resources.GetObject("numQuantity.PostValidation.Validation")));
            this.numQuantity.PreValidation.Inherit = ((C1.Win.C1Input.PreValidationInheritFlags)(resources.GetObject("numQuantity.PreValidation.Inherit")));
            this.numQuantity.PreValidation.ItemSeparator = resources.GetString("numQuantity.PreValidation.ItemSeparator");
            this.numQuantity.PreValidation.PatternString = resources.GetString("numQuantity.PreValidation.PatternString");
            this.numQuantity.PreValidation.RegexOptions = ((C1.Win.C1Input.RegexOptionFlags)(resources.GetObject("numQuantity.PreValidation.RegexOptions")));
            this.numQuantity.PreValidation.Validation = ((C1.Win.C1Input.PreValidationTypeEnum)(resources.GetObject("numQuantity.PreValidation.Validation")));
            this.numQuantity.Tag = null;
            // 
            // btnCheckQA
            // 
            this.btnCheckQA.AccessibleDescription = null;
            this.btnCheckQA.AccessibleName = null;
            resources.ApplyResources(this.btnCheckQA, "btnCheckQA");
            this.btnCheckQA.BackgroundImage = null;
            this.btnCheckQA.Font = null;
            this.btnCheckQA.Name = "btnCheckQA";
            this.btnCheckQA.Click += new System.EventHandler(this.btnCheckQA_Click);
            // 
            // POInvoice
            // 
            this.AccessibleDescription = null;
            this.AccessibleName = null;
            resources.ApplyResources(this, "$this");
            this.BackgroundImage = null;
            this.CancelButton = this.btnClose;
            this.Controls.Add(this.lblImportTaxRate);
            this.Controls.Add(this.lblVATTaxRate);
            this.Controls.Add(this.btnPrintConfiguration);
            this.Controls.Add(this.lblPOApprovalDate);
            this.Controls.Add(this.lblInputTotalInland);
            this.Controls.Add(this.txtBLNo);
            this.Controls.Add(this.txtDeclaredNo);
            this.Controls.Add(this.txtTaxInformNo);
            this.Controls.Add(this.txtCurrency);
            this.Controls.Add(this.txtCarrier);
            this.Controls.Add(this.txtPayTerms);
            this.Controls.Add(this.txtDeliveryTerms);
            this.Controls.Add(this.dgrdData);
            this.Controls.Add(this.txtInvoiceNo);
            this.Controls.Add(this.txtVendor);
            this.Controls.Add(this.txtVendorName);
            this.Controls.Add(this.lblBLNo);
            this.Controls.Add(this.numTotalCIPAmt);
            this.Controls.Add(this.numTotalInlandAmt);
            this.Controls.Add(this.lblTotalCIPAmt);
            this.Controls.Add(this.lblTotalInlandAmt);
            this.Controls.Add(this.dtmDeclareDate);
            this.Controls.Add(this.lblDeclareDate);
            this.Controls.Add(this.dtmInformDate);
            this.Controls.Add(this.lblInformDate);
            this.Controls.Add(this.lblTaxDeclareNo);
            this.Controls.Add(this.lblTaxInformNo);
            this.Controls.Add(this.dtmBLDate);
            this.Controls.Add(this.lblBLDate);
            this.Controls.Add(this.numTotalVatAmount);
            this.Controls.Add(this.numTotalBeforeVAT);
            this.Controls.Add(this.numTotalImpTax);
            this.Controls.Add(this.numTotalCIFAmount);
            this.Controls.Add(this.btnVendorName);
            this.Controls.Add(this.numExchRate);
            this.Controls.Add(this.dtmPostDate);
            this.Controls.Add(this.btnCurrency);
            this.Controls.Add(this.btnCarrier);
            this.Controls.Add(this.btnPayTerms);
            this.Controls.Add(this.btnDeliveryTerms);
            this.Controls.Add(this.lblTotalImpTax);
            this.Controls.Add(this.lblTotalDiscount);
            this.Controls.Add(this.lblSpecTax);
            this.Controls.Add(this.lblTotalVAT);
            this.Controls.Add(this.btnEdit);
            this.Controls.Add(this.btnClose);
            this.Controls.Add(this.btnHelp);
            this.Controls.Add(this.btnDelete);
            this.Controls.Add(this.btnSave);
            this.Controls.Add(this.btnAdd);
            this.Controls.Add(this.btnPrint);
            this.Controls.Add(this.btnInvoiceNo);
            this.Controls.Add(this.btnVendor);
            this.Controls.Add(this.cboCCN);
            this.Controls.Add(this.lblCCN);
            this.Controls.Add(this.lblExchRate);
            this.Controls.Add(this.lblCurrency);
            this.Controls.Add(this.lblVendor);
            this.Controls.Add(this.lblInvoiceNo);
            this.Controls.Add(this.lblOrderDate);
            this.Controls.Add(this.lblPayTerms);
            this.Controls.Add(this.lblDeliveryTerms);
            this.Controls.Add(this.lblCarrier);
            this.Controls.Add(this.numValue);
            this.Controls.Add(this.numQuantity);
            this.Controls.Add(this.btnCheckQA);
            this.Font = null;
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
            this.Icon = null;
            this.Name = "POInvoice";
            this.Load += new System.EventHandler(this.POInvoice_Load);
            this.Closing += new System.ComponentModel.CancelEventHandler(this.POInvoice_Closing);
            this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.POInvoice_KeyDown);
            ((System.ComponentModel.ISupportInitialize)(this.dgrdData)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.numTotalVatAmount)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.numTotalBeforeVAT)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.numTotalImpTax)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.numTotalCIFAmount)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.numExchRate)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.dtmPostDate)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.cboCCN)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.dtmBLDate)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.dtmInformDate)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.dtmDeclareDate)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.numTotalCIPAmt)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.numTotalInlandAmt)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.numValue)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.numQuantity)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

		}
		#endregion
		
		#region Private Methods		

		/// <summary>
		/// Build and show PO Invoice Report
		/// </summary>
		/// <Author> Tuan TQ, 05 Jan, 2006</Author>
		private void ShowPOInvoiceReport(object sender, System.EventArgs e)
		{	
			const string METHOD_NAME = THIS + ".ShowPOInvoiceReport()";
			try
			{				
				const string APPLICATION_PATH  = @"PCSMain\bin\Debug";

				const string REPORTFLD_TITLE = "fldTitle";

				const string REPORT_COMPANY_FLD = "fldCompany";
				const string TOTALAMOUNT_FLD = "fldTotalCIFAmount";
				const string TEXTTOTALAMOUNT_FLD = "fldTotalAmountInWord";

				const string INVOICE_REPORT_LAYOUT = "InvoiceReport.xml";
				
				//return if no record was selected
				if(voMaster.InvoiceMasterID <= 0)
				{
					return;
				}				
				
				this.Cursor = Cursors.WaitCursor;

				C1PrintPreviewDialog   printPreview = new C1PrintPreviewDialog();
				C1PrintPreviewDialogBO boDataReport = new C1PrintPreviewDialogBO();
			
				DataTable dtbResult;
				decimal decExRate = 0;
				try
				{
					decExRate = Convert.ToDecimal(numExchRate.Value);
				}
				catch{}
				dtbResult = boDataReport.GetPOInvoiceData(voMaster.InvoiceMasterID, txtCurrency.Text, decExRate);

				// Check data source
				if(dtbResult == null)
				{
					this.Cursor = Cursors.Default;
					return;
				}

				ReportBuilder reportBuilder = new ReportBuilder();
			
				//Get actual application path
				string strReportPath = Application.StartupPath;
				int intIndex = strReportPath.IndexOf(APPLICATION_PATH);
				if (intIndex > -1 ) 
				{
					strReportPath = strReportPath.Substring(0, intIndex);
				}

				if(strReportPath.Substring(strReportPath.Length -1) == @"\")
				{
					strReportPath += Constants.REPORT_DEFINITION_STORE_LOCATION;
				}
				else
				{
					strReportPath += @"\" + Constants.REPORT_DEFINITION_STORE_LOCATION;
				}				
			
				//Set datasource and lay-out path for reports
				reportBuilder.SourceDataTable = dtbResult;
				reportBuilder.ReportDefinitionFolder = strReportPath;
			
				reportBuilder.ReportLayoutFile = INVOICE_REPORT_LAYOUT;

				//check if layout is valid
				if(reportBuilder.AnalyseLayoutFile())
				{					
					reportBuilder.UseLayoutFile = true;
				}
				else
				{
					this.Cursor = Cursors.Default;
					PCSMessageBox.Show(ErrorCode.MESSAGE_REPORT_TEMPLATE_FILE_NOT_FOUND, MessageBoxIcon.Error);
					return;
				}

				reportBuilder.MakeDataTableForRender();

				// and show it in preview dialog				
				
				reportBuilder.ReportViewer = printPreview.ReportViewer;
				reportBuilder.RenderReport();
		
				//Header information get from system params
				reportBuilder.DrawPredefinedField(REPORT_COMPANY_FLD, SystemProperty.SytemParams.Get(SystemParam.COMPANY_FULL_NAME));

				try
				{
					decimal decTotalAmount = decimal.Round(Convert.ToDecimal(reportBuilder.GetFieldByName(TOTALAMOUNT_FLD).Value), 0);
					string strTotalAmountInWord = PCSUtils.Utils.ConvertNumberToWord.ChuyenSoThanhChu(decTotalAmount, Convert.ToInt32(txtCurrency.Tag));
					reportBuilder.DrawPredefinedField(TEXTTOTALAMOUNT_FLD, strTotalAmountInWord);
				}
				catch{}

				reportBuilder.RefreshReport();				
			
				//Print report
				try
				{
					printPreview.FormTitle = reportBuilder.GetFieldByName(REPORTFLD_TITLE).Text;
				}
				catch{}
				printPreview.Show();		
			}
			catch (PCSException ex)
			{
				// displays the error message.
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				// log message.
				try
				{
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
				}
			}
			catch(Exception ex)
			{
				// displays the error message.
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				// log message.
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
			finally
			{
				this.Cursor = Cursors.Default;
			}
		}		
		
		/// <summary>
		/// Build and show KCS Report
		/// </summary>
		private void ShowKCSReport(object sender, System.EventArgs e)
		{	
			const string METHOD_NAME = THIS + ".ShowKCSReport()";
			try
			{				
				const string APPLICATION_PATH  = @"PCSMain\bin\Debug";

				const string REPORTFLD_TITLE = "fldTitle";

				const string REPORT_COMPANY_FLD = "fldCompany";

				const string INVOICE_REPORT_LAYOUT = "BienBanKCS.xml";
				
				//return if no record was selected
				if(voMaster.InvoiceMasterID <= 0)
				{
					return;
				}				
				
				this.Cursor = Cursors.WaitCursor;

				C1PrintPreviewDialog   printPreview = new C1PrintPreviewDialog();
				C1PrintPreviewDialogBO boDataReport = new C1PrintPreviewDialogBO();
			
				DataTable dtbResult;
				dtbResult = boDataReport.GetKCSReportData(voMaster.InvoiceMasterID);

				// Check data source
				if(dtbResult == null)
				{
					this.Cursor = Cursors.Default;
					return;
				}

				ReportBuilder reportBuilder = new ReportBuilder();
			
				//Get actual application path
				string strReportPath = Application.StartupPath;
				int intIndex = strReportPath.IndexOf(APPLICATION_PATH);
				if ( intIndex > -1 ) 
				{
					strReportPath = strReportPath.Substring(0, intIndex);
				}

				if(strReportPath.Substring(strReportPath.Length -1) == @"\")
				{
					strReportPath += Constants.REPORT_DEFINITION_STORE_LOCATION;
				}
				else
				{
					strReportPath += @"\" + Constants.REPORT_DEFINITION_STORE_LOCATION;
				}				
			
				//Set datasource and lay-out path for reports
				reportBuilder.SourceDataTable = dtbResult;
				reportBuilder.ReportDefinitionFolder = strReportPath;
			
				reportBuilder.ReportLayoutFile = INVOICE_REPORT_LAYOUT;

				//check if layout is valid
				if(reportBuilder.AnalyseLayoutFile())
				{					
					reportBuilder.UseLayoutFile = true;
				}
				else
				{
					this.Cursor = Cursors.Default;
					PCSMessageBox.Show(ErrorCode.MESSAGE_REPORT_TEMPLATE_FILE_NOT_FOUND, MessageBoxIcon.Error);
					return;
				}

				reportBuilder.MakeDataTableForRender();

				// and show it in preview dialog				
				
				reportBuilder.ReportViewer = printPreview.ReportViewer;
				reportBuilder.RenderReport();
		
				//Header information get from system params
				reportBuilder.DrawPredefinedField(REPORT_COMPANY_FLD, SystemProperty.SytemParams.Get(SystemParam.COMPANY_FULL_NAME));

				reportBuilder.RefreshReport();				
			
				//Print report
				try
				{
					printPreview.FormTitle = reportBuilder.GetFieldByName(REPORTFLD_TITLE).Text;
				}
				catch{}
				printPreview.Show();		
			}
			catch (PCSException ex)
			{
				// displays the error message.
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				// log message.
				try
				{
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
				}
			}
			catch(Exception ex)
			{
				// displays the error message.
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				// log message.
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
			finally
			{
				this.Cursor = Cursors.Default;
			}
		}		
		

		private void ClearGrid()
		{			
			int iRowCount = GetActualRowCount(dtbDetail);

			for(int i =0; i < iRowCount; i++)
			{
				dgrdData.Delete();
			}
		}

		private int GetActualRowCount(DataTable pdtbDataTable)
		{
			int iCount = 0;
			foreach(DataRow dtRow in pdtbDataTable.Rows)
			{
				if(dtRow.RowState != DataRowState.Deleted)
				{
					iCount++;
				}
			}

			return iCount;
		}

		private void AssignControlValue2VO()
		{
			const string METHOD_NAME = THIS + ".AssignControlValue2VO()";
			try
			{
				//voMaster.PostDate = DateTime.Parse(dtmPostDate.Value.ToString());
				voMaster.PostDate = (DateTime)dtmPostDate.Value;
				voMaster.CCNID = int.Parse(cboCCN.SelectedValue.ToString());
				voMaster.InvoiceNo = txtInvoiceNo.Text.Trim();				
				voMaster.PaymentTermID = int.Parse(txtPayTerms.Tag.ToString());
				voMaster.PartyID = int.Parse(txtVendor.Tag.ToString());
				voMaster.CarrierID = int.Parse(txtCarrier.Tag.ToString());
				voMaster.DeliveryTermID = int.Parse(txtDeliveryTerms.Tag.ToString());
				voMaster.CurrencyID = int.Parse(txtCurrency.Tag.ToString());

				voMaster.TaxDeclarationNumber = txtDeclaredNo.Text.Trim();
				voMaster.TaxInformNumber = txtTaxInformNo.Text.Trim();
				voMaster.BLNumber = txtBLNo.Text.Trim();			
				
				if(!numExchRate.ValueIsDbNull)
				{
					voMaster.ExchangeRate = decimal.Parse(numExchRate.Value.ToString());
				}
				
				//BLDate
				if(!dtmBLDate.ValueIsDbNull)
				{
					voMaster.BLDate = (DateTime)dtmBLDate.Value;
					//voMaster.BLDate = DateTime.Parse(dtmBLDate.Value.ToString());
				}
				else
				{
					voMaster.BLDate = DateTime.MinValue;
				}

				//Declaration Date
				if(!dtmDeclareDate.ValueIsDbNull)
				{
					voMaster.DeclarationDate = (DateTime)dtmDeclareDate.Value;
					//voMaster.DeclarationDate = DateTime.Parse(dtmDeclareDate.Value.ToString());
				}
				else
				{
					voMaster.DeclarationDate = DateTime.MinValue;
				}

				//Inform Date
				if(!dtmInformDate.ValueIsDbNull)
				{
					voMaster.InformDate = (DateTime)dtmInformDate.Value;
					//voMaster.InformDate = DateTime.Parse(dtmInformDate.Value.ToString());
				}
				else
				{
					voMaster.InformDate = DateTime.MinValue;
				}

				//Before VAT amount
				if(!numTotalBeforeVAT.ValueIsDbNull)
				{
					voMaster.TotalBeforeVATAmount = decimal.Parse(numTotalBeforeVAT.Value.ToString());
				}
				
				//CIF amount
				if(!numTotalCIFAmount.ValueIsDbNull)
				{
					voMaster.TotalCIFAmount = decimal.Parse(numTotalCIFAmount.Value.ToString());				
				}

				//CIP amount
				if(!numTotalCIPAmt.ValueIsDbNull)
				{
					voMaster.TotalCIPAmount = decimal.Parse(numTotalCIPAmt.Value.ToString());
				}
				
				//TotalImportTax amount
				if(!numTotalImpTax.ValueIsDbNull)
				{
					voMaster.TotalImportTax = decimal.Parse(numTotalImpTax.Value.ToString());
				}

				//TotalInlandAmt amount
				if(!numTotalInlandAmt.ValueIsDbNull)
				{
					voMaster.TotalInlandAmount = decimal.Parse(numTotalInlandAmt.Value.ToString());
				}

				//TotalVATAmount amount
				if(!numTotalVatAmount.ValueIsDbNull)
				{
					voMaster.TotalVATAmount = decimal.Parse(numTotalVatAmount.Value.ToString());
				}
			}
			catch (PCSException ex)
			{
				throw new PCSException(ex.mCode, METHOD_NAME, ex);
			}
			catch (Exception ex)
			{
				throw new Exception(ex.Message, ex);
			}
		}

		/// <summary>
		/// Validate data before updating into database
		/// </summary>
		/// <returns></returns>
		/// <author> Tran Quoc Tuan </author>
		/// <created date> 
		/// 15 June 2005
		/// </created>
		private bool ValidateData()
		{
			const string METHOD_NAME = THIS + ".ValidateData()";
			try
			{
				if (cboCCN.SelectedIndex <0)
				{					
					PCSMessageBox.Show(ErrorCode.MANDATORY_INVALID, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
					cboCCN.Focus();				
					return false;
				}				

				//Check As Of date
				if (dtmPostDate.ValueIsDbNull || (dtmPostDate.Text == string.Empty))
				{					
					PCSMessageBox.Show(ErrorCode.MANDATORY_INVALID, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
					dtmPostDate.Focus();				
					return false;
				}

				#region no need to check period

//				if (!FormControlComponents.CheckDateInCurrentPeriod((DateTime)dtmPostDate.Value))
//				{
//					PCSMessageBox.Show(ErrorCode.MESSAGE_RGV_POSTDATE_PERIOD, MessageBoxIcon.Exclamation);
//					dtmPostDate.Focus();
//					return false;
//				}

				#endregion

				//Check Cycle no
				if (FormControlComponents.CheckMandatory(txtInvoiceNo))
				{					
					PCSMessageBox.Show(ErrorCode.MANDATORY_INVALID, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
					txtInvoiceNo.Focus();				
					return false;
				}
				
				if(boMaster.GetObjectVO(txtInvoiceNo.Text) != null && !txtInvoiceNo.Text.Trim().ToUpper().Equals(voMaster.InvoiceNo.ToUpper()))
				{					
					PCSMessageBox.Show(ErrorCode.DUPLICATE_KEY, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
					txtInvoiceNo.Focus();
					return false;
				}
				
				//Check Cycle no
				if (FormControlComponents.CheckMandatory(txtCurrency))
				{					
					PCSMessageBox.Show(ErrorCode.MANDATORY_INVALID, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
					txtCurrency.Focus();				
					return false;
				}				
				
				if (numExchRate.ValueIsDbNull)
				{					
					PCSMessageBox.Show(ErrorCode.MANDATORY_INVALID, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
					numExchRate.Focus();				
					return false;
				}

				if(!FormControlComponents.IsPositiveNumeric(numExchRate.Value.ToString())
					|| decimal.Parse(numExchRate.Value.ToString()) <= 0)
				{					
					PCSMessageBox.Show(ErrorCode.MESSAGE_INVALID_NUMERIC, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
					numExchRate.Focus();				
					return false;
				}
				
				//Check Cycle no
				if (FormControlComponents.CheckMandatory(txtVendor))
				{					
					PCSMessageBox.Show(ErrorCode.MANDATORY_INVALID, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
					txtVendor.Focus();				
					return false;
				}
				
				//Call update data to force grid update data
				dgrdData.UpdateData();

				//Check data in the grid
				int iRowCount = GetActualRowCount(dtbDetail);
				if(iRowCount == 0)
				{					
					PCSMessageBox.Show(ErrorCode.MESSAGE_PLEASE_ENTER_DETAIL_INFOR, MessageBoxIcon.Exclamation);
					dgrdData.Col = dgrdData.Columns.IndexOf(dgrdData.Columns[PO_PurchaseOrderMasterTable.TABLE_NAME + PO_PurchaseOrderMasterTable.CODE_FLD]);
					dgrdData.Row = 0;
					dgrdData.Focus();
					return false;
				}
				
				//variable to indicate grid's row index
				int intRowIndex = -1;

				//Collect PO Detail ID to compare approved date
				string strPODetailIDs = "0";

				foreach (DataRow drowRow in dtbDetail.Rows)
				{
					//Inorge deleted row
					if(drowRow.RowState == DataRowState.Deleted) continue;

					intRowIndex++;

					if(drowRow[PO_PurchaseOrderMasterTable.TABLE_NAME + PO_PurchaseOrderMasterTable.CODE_FLD].Equals(DBNull.Value)
					|| drowRow[PO_PurchaseOrderMasterTable.TABLE_NAME + PO_PurchaseOrderMasterTable.CODE_FLD].ToString().Equals(string.Empty))
					{
						// Please input Item field for each records.
						PCSMessageBox.Show(ErrorCode.MANDATORY_INVALID, MessageBoxIcon.Exclamation);
						dgrdData.Row = intRowIndex;
						dgrdData.Col = dgrdData.Columns.IndexOf(dgrdData.Columns[PO_PurchaseOrderMasterTable.TABLE_NAME + PO_PurchaseOrderMasterTable.CODE_FLD]);
						dgrdData.Focus();
						return false;
					}

					if(!FormControlComponents.IsPositiveNumeric(drowRow[PO_InvoiceDetailTable.INVOICEQUANTITY_FLD].ToString()))
					{						
						// Please input Item field for each records.
						PCSMessageBox.Show(ErrorCode.MESSAGE_OUTPROCESSING_INVALID_NUMBER, MessageBoxIcon.Exclamation);
						dgrdData.Row = intRowIndex;
						dgrdData.Col = dgrdData.Columns.IndexOf(dgrdData.Columns[PO_InvoiceDetailTable.INVOICEQUANTITY_FLD]);
						dgrdData.Focus();
						return false;
					}

					if(decimal.Parse(drowRow[PO_InvoiceDetailTable.INVOICEQUANTITY_FLD].ToString()) == 0)
					{						
						// Please input Item field for each records.
						PCSMessageBox.Show(ErrorCode.MESSAGE_OUTPROCESSING_INVALID_NUMBER, MessageBoxIcon.Exclamation);
						dgrdData.Row = intRowIndex;
						dgrdData.Col = dgrdData.Columns.IndexOf(dgrdData.Columns[PO_InvoiceDetailTable.INVOICEQUANTITY_FLD]);
						dgrdData.Focus();
						return false;
					}

					if(!FormControlComponents.IsPositiveNumeric(drowRow[PO_InvoiceDetailTable.UNITPRICE_FLD].ToString()))
					{						
						// Please input Item field for each records.
						PCSMessageBox.Show(ErrorCode.MESSAGE_OUTPROCESSING_INVALID_NUMBER, MessageBoxIcon.Exclamation);
						dgrdData.Row = intRowIndex;
						dgrdData.Col = dgrdData.Columns.IndexOf(dgrdData.Columns[PO_InvoiceDetailTable.UNITPRICE_FLD]);
						dgrdData.Focus();
						return false;
					}

					if(decimal.Parse(drowRow[PO_InvoiceDetailTable.UNITPRICE_FLD].ToString()) == 0)
					{						
						// Please input Item field for each records.
						PCSMessageBox.Show(ErrorCode.MESSAGE_OUTPROCESSING_INVALID_NUMBER, MessageBoxIcon.Exclamation);
						dgrdData.Row = intRowIndex;
						dgrdData.Col = dgrdData.Columns.IndexOf(dgrdData.Columns[PO_InvoiceDetailTable.UNITPRICE_FLD]);
						dgrdData.Focus();
						return false;
					}

					strPODetailIDs += ", " + drowRow[PO_InvoiceDetailTable.PURCHASEORDERDETAILID_FLD].ToString();
				}
				
				DateTime dtmApprovedDate = boMaster.GetEarliestApprovedDate(strPODetailIDs);

				if(((DateTime)dtmPostDate.Value) < dtmApprovedDate)
				{
					string[] arrMessage = new string[2];
					arrMessage[0] = lblOrderDate.Text;
					arrMessage[1] = lblPOApprovalDate.Text + " (" + dtmApprovedDate.ToString(Constants.DATETIME_FORMAT) + ")";

					PCSMessageBox.Show(ErrorCode.MESSAGE_GREATER_THAN, MessageBoxIcon.Exclamation, arrMessage);
					//dtmPostDate.Value = dtmApprovedDate;
					dtmPostDate.Focus();
					return false;
				}

				return true;				
			}
			catch (PCSException ex)
			{
				throw new PCSException(ex.mCode, METHOD_NAME, ex);
			}
			catch (Exception ex)
			{
				throw new Exception(ex.Message, ex);
			}
		}
		

		/// <summary>
		/// Lock controls for updating
		/// </summary>
		/// <param name="pblnLock"></param>
		/// <author> Tran Quoc Tuan </author>
		/// <created date> 
		/// 04 Otc 2005
		/// </created>
		private void LockControl(bool pblnLock)
		{
			int iRowCount = GetActualRowCount(dtbDetail);

			btnCarrier.Enabled = !pblnLock;				
			btnCurrency.Enabled = !pblnLock;
			btnDeliveryTerms.Enabled = !pblnLock;
			btnPayTerms.Enabled = !pblnLock;
			btnVendor.Enabled = !pblnLock;
			btnVendorName.Enabled = !pblnLock;
			btnSave.Enabled = !pblnLock;
			dtmPostDate.Enabled = !pblnLock;

			txtBLNo.Enabled = !pblnLock;
			txtCarrier.Enabled = !pblnLock;
			txtCurrency.Enabled = !pblnLock;
			txtDeclaredNo.Enabled = !pblnLock;
			txtDeliveryTerms.Enabled = !pblnLock;				
			txtPayTerms.Enabled = !pblnLock;
			txtTaxInformNo.Enabled = !pblnLock;
			txtVendor.Enabled = !pblnLock;
			txtVendorName.Enabled = !pblnLock;
			dtmBLDate.Enabled = !pblnLock;
			dtmDeclareDate.Enabled = !pblnLock;
			dtmInformDate.Enabled = !pblnLock;				
			dtmPostDate.Enabled = !pblnLock;

			numExchRate.Enabled = !pblnLock && !voMaster.CurrencyID.Equals(SystemProperty.DefaultCurrencyID);//false;
				
			btnInvoiceNo.Enabled = pblnLock;
			btnAdd.Enabled = pblnLock;
			btnEdit.Enabled = pblnLock && (iRowCount > 0);
			btnCheckQA.Enabled = pblnLock && (iRowCount > 0);
			btnDelete.Enabled = pblnLock && (iRowCount > 0);
			btnPrint.Enabled = pblnLock && (iRowCount > 0);
				
			dgrdData.AllowAddNew = !pblnLock;
			dgrdData.AllowUpdate = !pblnLock;
			dgrdData.AllowDelete = !pblnLock;				

			dgrdData.Splits[0].DisplayColumns[PO_PurchaseOrderMasterTable.TABLE_NAME + PO_PurchaseOrderMasterTable.CODE_FLD].Button = !pblnLock;
				
			if(!pblnLock)
			{
				dtmPostDate.Focus();
			}
			else
			{
				txtInvoiceNo.Focus();
			}
		}

		/// <summary>
		/// Reset value of controls for updating
		/// </summary>
		/// <param name="penuFormAction"></param>
		/// <author> Tran Quoc Tuan </author>
		/// <created date> 
		/// 15 June 2005
		/// </created>
		private void ResetControlValue(EnumAction penuFormAction)
		{
			//if action id add then get default value for Post Date and TransNo
			if(penuFormAction == EnumAction.Add)
			{
				UtilsBO boUtil = new UtilsBO();
				dtmPostDate.Value = boUtil.GetDBDate();
				txtInvoiceNo.Text = FormControlComponents.GetNoByMask(this);
			}	
			else
			{
				dtmPostDate.Value = DBNull.Value;
				txtInvoiceNo.Text = string.Empty;
			}
				
			txtInvoiceNo.Tag = ZERO_STRING;
			txtDeclaredNo.Text = string.Empty;
			txtTaxInformNo.Text = string.Empty;
			txtVendorName.Text = string.Empty;
			txtBLNo.Text = string.Empty;

			numExchRate.Value = DBNull.Value;
			numTotalCIPAmt.Value = DBNull.Value;
			numTotalBeforeVAT.Value = DBNull.Value;
			numTotalImpTax.Value = DBNull.Value;
			numTotalInlandAmt.Value = DBNull.Value;
			numTotalCIFAmount.Value = DBNull.Value;
			numTotalVatAmount.Value = DBNull.Value;
                				
			dtmBLDate.Value = DBNull.Value;
			dtmDeclareDate.Value = DBNull.Value;
			dtmInformDate.Value = DBNull.Value;
				
			txtCurrency.Text = string.Empty;				
			txtCurrency.Tag = ZERO_STRING;
				
			txtDeliveryTerms.Text = string.Empty;
			txtDeliveryTerms.Tag = ZERO_STRING;

			txtPayTerms.Text = string.Empty;
			txtPayTerms.Tag = ZERO_STRING;

			txtCarrier.Text = string.Empty;
			txtCarrier.Tag = ZERO_STRING;
				
			txtVendor.Text = string.Empty;
			txtVendorName.Text = string.Empty;
			txtVendor.Tag = ZERO_STRING;

			voMaster = new PO_InvoiceMasterVO();
			voMaster.InvoiceMasterID = 0;
			voMaster.InvoiceNo = string.Empty;
			
			//Create blank table then bind to grid
			dtbDetail = BuildDetailTable();
			dgrdData.DataSource = dtbDetail;
			FormatDataGrid();
		}
		
		/// <summary>
		/// This method will retrieve OutsideProcessing information to fill into controls
		/// in the form, including detail data for the grid
		/// </summary>
		/// <param name="pintMasterId"></param>
		/// <author> Tran Quoc Tuan </author>
		/// <created date> 
		/// 15 August 2005
		/// </created>		
		private void LoadDetailGrid(int pintMasterId)
		{
			//Load blank data if master id is invalid id 
			if(pintMasterId <= 0)
			{
				//create blank detail table
				dtbDetail = BuildDetailTable();
			}
			else
			{	
				//call bo's method tho retrieve data					
				dtbDetail = boMaster.GetDetailByMaster(pintMasterId).Tables[0];
			}

			// bind to grid & reformat grid
			dgrdData.DataSource = dtbDetail;				
			FormatDataGrid();
		}
		
		/// <summary>
		/// Update CIF Amount column's value of in grid
		/// <usage> Call when update in grid</usage>
		/// </summary>
		private void CalculateCIFAmount()
		{	
			decimal decQuantity = Decimal.Zero;
			decimal decUnitPrice = Decimal.Zero;

			if(!dgrdData[intCurrentRow, PO_InvoiceDetailTable.INVOICEQUANTITY_FLD].Equals(DBNull.Value)
				&& !dgrdData[intCurrentRow, PO_InvoiceDetailTable.INVOICEQUANTITY_FLD].ToString().Equals(string.Empty))
			{
				decQuantity = decimal.Parse(dgrdData[intCurrentRow, PO_InvoiceDetailTable.INVOICEQUANTITY_FLD].ToString());
			}

			if(!dgrdData[intCurrentRow, PO_InvoiceDetailTable.UNITPRICE_FLD].Equals(DBNull.Value)
				&& !dgrdData[intCurrentRow, PO_InvoiceDetailTable.UNITPRICE_FLD].ToString().Equals(string.Empty))
			{
				decUnitPrice = decimal.Parse(dgrdData[intCurrentRow, PO_InvoiceDetailTable.UNITPRICE_FLD].ToString());
			}
			//Update CIF amount
			dgrdData[intCurrentRow, PO_InvoiceDetailTable.CIFAMOUNT_FLD]=  decQuantity * decUnitPrice;

			// Calculate Total CIF amount
			decimal decTotalCIFAmount = Decimal.Zero;
			int iRowCount = GetActualRowCount(dtbDetail);

			for(int i = 0; i < iRowCount; i++)
			{
				if(!dgrdData[intCurrentRow, PO_InvoiceDetailTable.CIFAMOUNT_FLD].Equals(DBNull.Value))
				{
					try
					{
						decTotalCIFAmount += decimal.Parse(dgrdData[intCurrentRow, PO_InvoiceDetailTable.CIFAMOUNT_FLD].ToString());
					}
					catch{}
				}
			}

			//Update Total CIF Amount
			numTotalCIFAmount.Value = decTotalCIFAmount;
		}

		/// <summary>
		/// Update TotalCIFAmount
		/// <usage> Call when update in grid or delete row</usage>
		/// </summary>
		private void CalculateTotalCIFAmount(int pintRowCount)
		{
			// Calculate Total CIF amount
			decimal decTotalCIFAmount = Decimal.Zero;				
			for(int i = 0; i < pintRowCount; i++)
			{
				if(!dgrdData[i, PO_InvoiceDetailTable.CIFAMOUNT_FLD].Equals(DBNull.Value)
					&& !dgrdData[i, PO_InvoiceDetailTable.CIFAMOUNT_FLD].ToString().Equals(string.Empty))
				{
					try
					{
						decTotalCIFAmount += decimal.Parse(dgrdData[i, PO_InvoiceDetailTable.CIFAMOUNT_FLD].ToString());
					}
					catch{}
				}
			}

			//Update Total CIF Amount
			numTotalCIFAmount.Value = decTotalCIFAmount;
		}
		
		/// <summary>
		/// Calculate value of ImportAmount column
		/// <usage> Call when update in grid</usage>
		/// </summary>
		private void CalculateImportAmount()
		{			
			//Imp Amount = CIF Amount * 0.01 * % Imp; System update Total Imp Amount
			decimal decImportVAT = Decimal.Zero;
			decimal decCIFAmount = Decimal.Zero;

			if(!dgrdData[intCurrentRow, PO_InvoiceDetailTable.IMPORTTAX_FLD].Equals(DBNull.Value)
				&& !dgrdData[intCurrentRow, PO_InvoiceDetailTable.IMPORTTAX_FLD].ToString().Equals(string.Empty))
			{
				try
				{
					decImportVAT = decimal.Parse(dgrdData[intCurrentRow, PO_InvoiceDetailTable.IMPORTTAX_FLD].ToString());
				}
				catch{}
			}

			if(!dgrdData[intCurrentRow, PO_InvoiceDetailTable.CIFAMOUNT_FLD].Equals(DBNull.Value)
				&& !dgrdData[intCurrentRow, PO_InvoiceDetailTable.CIFAMOUNT_FLD].ToString().Equals(string.Empty))
			{
				decCIFAmount = decimal.Parse(dgrdData[intCurrentRow, PO_InvoiceDetailTable.CIFAMOUNT_FLD].ToString());
			}
			//Calculate Import amount
			dgrdData[intCurrentRow, PO_InvoiceDetailTable.IMPORTTAXAMOUNT_FLD]=  decCIFAmount * (decimal)0.01 * decImportVAT;
		}
		
		/// <summary>
		/// Update TotalCIFAmount
		/// <usage> Call when update in grid or delete row</usage>
		/// </summary>
		private void CalculateTotalImportAmount(int pintRowCount)
		{
			// Calculate Total Import amount
			decimal decTotalImportAmount = Decimal.Zero;				
			for(int i = 0; i < pintRowCount; i++)
			{
				if(!dgrdData[i, PO_InvoiceDetailTable.IMPORTTAXAMOUNT_FLD].Equals(DBNull.Value)
					&& !dgrdData[i, PO_InvoiceDetailTable.IMPORTTAXAMOUNT_FLD].ToString().Equals(string.Empty))
				{
					try
					{
						decTotalImportAmount += decimal.Parse(dgrdData[i, PO_InvoiceDetailTable.IMPORTTAXAMOUNT_FLD].ToString());
					}
					catch{}
				}
			}

			//Update Total CIF Amount
			numTotalImpTax.Value = decTotalImportAmount;
		}
		
		/// <summary>
		/// Calculate value of BeforeVATAmount column
		/// <usage> Call when update in grid</usage>
		/// </summary>
		private void CalculateBeforeVATAmount()
		{			
			//Before VAT = CIF Amount + Imp Amount; System update Total Before VAT Amount
			decimal decImportAmount = Decimal.Zero;
			decimal decCIFAmount = Decimal.Zero;

			if(!dgrdData[intCurrentRow, PO_InvoiceDetailTable.IMPORTTAXAMOUNT_FLD].Equals(DBNull.Value)
				&& !dgrdData[intCurrentRow, PO_InvoiceDetailTable.IMPORTTAXAMOUNT_FLD].ToString().Equals(string.Empty))
			{
				decImportAmount = decimal.Parse(dgrdData[intCurrentRow, PO_InvoiceDetailTable.IMPORTTAXAMOUNT_FLD].ToString());
			}

			if(!dgrdData[intCurrentRow, PO_InvoiceDetailTable.CIFAMOUNT_FLD].Equals(DBNull.Value)
				&& !dgrdData[intCurrentRow, PO_InvoiceDetailTable.CIFAMOUNT_FLD].ToString().Equals(string.Empty))
			{
				decCIFAmount = decimal.Parse(dgrdData[intCurrentRow, PO_InvoiceDetailTable.CIFAMOUNT_FLD].ToString());
			}

			//Update BeforeVATAmount
			dgrdData[intCurrentRow, PO_InvoiceDetailTable.BEFOREVATAMOUNT_FLD]=  decCIFAmount + decImportAmount;
		}
		
		/// <summary>
		/// Update TotalCIFAmount
		/// <usage> Call when update in grid or delete row</usage>
		/// </summary>
		private void CalculateTotalBeforeVATAmount(int pintRowCount)
		{
			// Calculate Total BeforeVATAmount
			decimal decTotalBeforeVATAmount = Decimal.Zero;				
			for(int i = 0; i < pintRowCount ; i++)
			{
				if(!dgrdData[i, PO_InvoiceDetailTable.BEFOREVATAMOUNT_FLD].Equals(DBNull.Value)
					&& !dgrdData[i, PO_InvoiceDetailTable.BEFOREVATAMOUNT_FLD].ToString().Equals(string.Empty))
				{
					try
					{
						decTotalBeforeVATAmount += decimal.Parse(dgrdData[i, PO_InvoiceDetailTable.BEFOREVATAMOUNT_FLD].ToString());
					}
					catch{}
				}
			}

			//Update Total BeforeVATAmount
			numTotalBeforeVAT.Value = decTotalBeforeVATAmount;
		}
		
		/// <summary>
		/// Calculate value of VATAmount column
		/// <usage> Call when update in grid</usage>
		/// </summary>
		private void CalculateVATAmount()
		{			
			//VAT Amount = Before VAT * 0.01 * % VAT; System update Total VAT Amount
			decimal decBeforVATAmount = Decimal.Zero;
			decimal decVAT = Decimal.Zero;

			if(!dgrdData[intCurrentRow, PO_InvoiceDetailTable.BEFOREVATAMOUNT_FLD].Equals(DBNull.Value)
				&& !dgrdData[intCurrentRow, PO_InvoiceDetailTable.BEFOREVATAMOUNT_FLD].ToString().Equals(string.Empty))
			{
				decBeforVATAmount = decimal.Parse(dgrdData[intCurrentRow, PO_InvoiceDetailTable.BEFOREVATAMOUNT_FLD].ToString());
			}

			if(!dgrdData[intCurrentRow, PO_InvoiceDetailTable.VAT_FLD].Equals(DBNull.Value)
				&& !dgrdData[intCurrentRow, PO_InvoiceDetailTable.VAT_FLD].ToString().Equals(string.Empty))
			{
				decVAT = decimal.Parse(dgrdData[intCurrentRow, PO_InvoiceDetailTable.VAT_FLD].ToString());
			}

			//Calculate VATAmount
			dgrdData[intCurrentRow, PO_InvoiceDetailTable.VATAMOUNT_FLD]=  decBeforVATAmount * (decimal)0.01 * decVAT;
		}
		
		/// <summary>
		/// Update TotalCIFAmount
		/// <usage> Call when update in grid or delete row</usage>
		/// </summary>
		private void CalculateTotalVATAmount(int pintRowCount)
		{
			// Calculate Total VAT amount
			decimal decTotalVATAmount = Decimal.Zero;
			for(int i = 0; i < pintRowCount; i++)
			{
				if(!dgrdData[i, PO_InvoiceDetailTable.VATAMOUNT_FLD].Equals(DBNull.Value)
					&& !dgrdData[i, PO_InvoiceDetailTable.VATAMOUNT_FLD].ToString().Equals(string.Empty))
				{
					try
					{
						decTotalVATAmount += decimal.Parse(dgrdData[i, PO_InvoiceDetailTable.VATAMOUNT_FLD].ToString());
					}
					catch{}
				}
			}

			//Update Total VAT Amount
			numTotalVatAmount.Value = decTotalVATAmount;
		}
		
		/// <summary>
		/// Calculate value of CIPAmount column
		/// <usage> Call when update in grid</usage>
		/// </summary>
		private void CalculateCIPAmount()
		{
			//CIP = CIF + Inland; System update Total Inland Amount; System update Total CIP Amount
			decimal decCIF = Decimal.Zero;
			decimal decInland = Decimal.Zero;

			if(!dgrdData[intCurrentRow, PO_InvoiceDetailTable.CIFAMOUNT_FLD].Equals(DBNull.Value)
				&& !dgrdData[intCurrentRow, PO_InvoiceDetailTable.CIFAMOUNT_FLD].ToString().Equals(string.Empty))
			{
				decCIF = decimal.Parse(dgrdData[intCurrentRow, PO_InvoiceDetailTable.CIFAMOUNT_FLD].ToString());
			}

			if(!dgrdData[intCurrentRow, PO_InvoiceDetailTable.INLAND_FLD].Equals(DBNull.Value)
				&& !dgrdData[intCurrentRow, PO_InvoiceDetailTable.INLAND_FLD].ToString().Equals(string.Empty))
			{
				decInland = decimal.Parse(dgrdData[intCurrentRow, PO_InvoiceDetailTable.INLAND_FLD].ToString());
			}

			//Calculate CIP Amount
			dgrdData[intCurrentRow, PO_InvoiceDetailTable.CIPAMOUNT_FLD]=  decCIF + decInland;
		}
		
		/// <summary>
		/// Update TotalCIFAmount
		/// <usage> Call when update in grid or delete row</usage>
		/// </summary>
		private void CalculateTotalCIPAmount(int pintRowCount)
		{
			// Calculate Total CIP amount
			decimal decTotalCIPAmount = Decimal.Zero;
			for(int i = 0; i < pintRowCount; i++)
			{
				if(!dgrdData[i, PO_InvoiceDetailTable.CIPAMOUNT_FLD].Equals(DBNull.Value)
					&& !dgrdData[i, PO_InvoiceDetailTable.CIPAMOUNT_FLD].ToString().Equals(string.Empty))
				{
					decTotalCIPAmount += decimal.Parse(dgrdData[i, PO_InvoiceDetailTable.CIPAMOUNT_FLD].ToString());
				}
			}

			//Update Total CIP Amount
			numTotalCIPAmt.Value = decTotalCIPAmount;
		}

		/// <summary>
		/// Update TotalCIFAmount
		/// <usage> Call when update in grid or delete row</usage>
		/// </summary>
		private void CalculateTotalInlandAmount(int pintRowCount)
		{
			// Calculate Total Inland amount
			decimal decTotalInLandAmount = Decimal.Zero;
			for(int i = 0; i < pintRowCount; i++)
			{
				if(!dgrdData[i, PO_InvoiceDetailTable.INLAND_FLD].Equals(DBNull.Value)
					&& !dgrdData[i, PO_InvoiceDetailTable.INLAND_FLD].ToString().Equals(string.Empty))
				{
					decTotalInLandAmount += decimal.Parse(dgrdData[i, PO_InvoiceDetailTable.INLAND_FLD].ToString());
				}
			}

			//Update Total Inland Amount
			numTotalInlandAmt.Value = decTotalInLandAmount;
		}

		/// <summary>
		/// process data inputed into the grid
		/// </summary>
		/// <param name="pstrColumnName"></param>
		/// <param name="pstrColumValue"></param>
		/// <returns>If no error then return true, else return false</returns>
		private bool ProcessInputDataInGrid(string pstrColumnName, string pstrColumValue, bool pblnAlwaysShow)
		{
			bool blnResult = true;
			Hashtable htbCondition = new Hashtable();
			Hashtable htbSelectedRows;

			//Check Cycle no
			if (cboCCN.SelectedIndex < 0)
			{
				PCSMessageBox.Show(ErrorCode.MESSAGE_MATERIALRECEIPT_SELECT_CNN, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
				cboCCN.Focus();				
				return false;
			}

			if (FormControlComponents.CheckMandatory(txtVendor))
			{
				PCSMessageBox.Show(ErrorCode.MESSAGE_OUTPROCESSING_INPUT_VENDOR, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
				txtVendor.Focus();				
				return false;
			}

			//Check for each column
			switch (pstrColumnName)
			{
				case PO_PurchaseOrderMasterTable.TABLE_NAME + PO_PurchaseOrderMasterTable.CODE_FLD:					
					// 
					if(dgrdData[dgrdData.Row, PO_InvoiceDetailTable.INVOICEDETAILID_FLD] != DBNull.Value
						&& dgrdData[dgrdData.Row, PO_InvoiceDetailTable.INVOICEDETAILID_FLD].ToString() != string.Empty)
					{
						//Check if Invoice has been receipt
						POInvoiceBO boPOInvoice = new POInvoiceBO();
						if (boPOInvoice.CheckIfInvoiceHasBeenReceipt(int.Parse(dgrdData[dgrdData.Row, PO_InvoiceDetailTable.INVOICEDETAILID_FLD].ToString())))
						{
							return false;
						}
					}
					//clear hash table for new condition
					htbCondition.Clear();
					htbCondition.Add(PO_PurchaseOrderMasterTable.CCNID_FLD, cboCCN.SelectedValue);
					htbCondition.Add(PO_PurchaseOrderMasterTable.PARTYID_FLD, txtVendor.Tag);						

					SelectPurchaseOrders frmSelect = new SelectPurchaseOrders(htbCondition);
					frmSelect.ShowDialog();

					htbSelectedRows = frmSelect.SelectedRows;
					if(htbSelectedRows == null)
						blnResult = pblnAlwaysShow;
					else
					{
						if (htbSelectedRows.Count != 0)
							AddSelectedData2DataGrid(htbSelectedRows);
						else
							blnResult = pblnAlwaysShow;
					}

					break;
					
				case PO_InvoiceDetailTable.INVOICEQUANTITY_FLD:
					//Check if invoice amount is a positive numeric
					if(pstrColumValue.Length != 0)
					{
						if(!FormControlComponents.IsPositiveNumeric(pstrColumValue) || pstrColumValue.Equals(ZERO_STRING))
						{
							PCSMessageBox.Show(ErrorCode.MESSAGE_OUTPROCESSING_INVALID_NUMBER, MessageBoxIcon.Exclamation);
							dgrdData.Col = dgrdData.Columns.IndexOf(dgrdData.Columns[PO_InvoiceDetailTable.INVOICEQUANTITY_FLD]);
							dgrdData.Focus();							
							blnResult = false;
						}						
					}
					break;

				case PO_InvoiceDetailTable.NGQUANTITY_FLD:
					//Check if invoice amount is a positive numeric
					if(dgrdData.Columns[PO_InvoiceDetailTable.NGQUANTITY_FLD].Text.Length != 0)
					{
						if(!FormControlComponents.IsPositiveNumeric(pstrColumValue) || pstrColumValue.Equals(ZERO_STRING))
						{
							PCSMessageBox.Show(ErrorCode.MESSAGE_OUTPROCESSING_INVALID_NUMBER, MessageBoxIcon.Exclamation);
							dgrdData.Col = dgrdData.Columns.IndexOf(dgrdData.Columns[PO_InvoiceDetailTable.NGQUANTITY_FLD]);
							dgrdData.Focus();							
							blnResult = false;
						}
						decimal decInvoiceQty = 0, decNGQuantity = 0;
						try
						{
							decInvoiceQty = Convert.ToDecimal(dgrdData[dgrdData.Row, PO_InvoiceDetailTable.INVOICEQUANTITY_FLD]);
						}
						catch{}
						try
						{
							decNGQuantity = Convert.ToDecimal(dgrdData.Columns[PO_InvoiceDetailTable.NGQUANTITY_FLD].Text);
						}
						catch{}
						if (decNGQuantity > decInvoiceQty)
						{
							string[] strMsg = new string[]{"0", decInvoiceQty.ToString(Constants.DECIMAL_NUMBERFORMAT)};
							PCSMessageBox.Show(ErrorCode.MESSAGE_NUMBER_MUST_IN_SCOPE, MessageBoxIcon.Warning, strMsg);
							blnResult = false;
						}
					}
					break;
					
				case PO_InvoiceDetailTable.UNITPRICE_FLD:
					//Check if invoice amount is a positive numeric
					if(pstrColumValue.Length != 0)
					{
						if(!FormControlComponents.IsPositiveNumeric(pstrColumValue) || pstrColumValue.Equals(ZERO_STRING))
						{
							if(pstrColumValue.Equals(ZERO_STRING)) break; // do nothing
							PCSMessageBox.Show(ErrorCode.MESSAGE_OUTPROCESSING_INVALID_NUMBER, MessageBoxIcon.Exclamation);
							dgrdData.Col = dgrdData.Columns.IndexOf(dgrdData.Columns[PO_InvoiceDetailTable.UNITPRICE_FLD]);
							dgrdData.Focus();							
							blnResult = false;
						}
					}
					break;

				case PO_InvoiceDetailTable.IMPORTTAX_FLD:
					if(pstrColumValue.Length != 0)
					{
						//Check if invoice amount is a positive numeric
						if(!FormControlComponents.IsValidPercent(pstrColumValue))
						{
							//HACK: VAT may be zero
							decimal dblTempVAT = decimal.Zero; 
							try
							{
								dblTempVAT = decimal.Parse(pstrColumValue);
							}
							catch
							{
								dblTempVAT = decimal.MinusOne;
							}
								
							if(dblTempVAT != decimal.Zero)
							{								
								PCSMessageBox.Show(ErrorCode.MESSAGE_C1NUMBER_INPUT_VALUE, MessageBoxIcon.Exclamation, new string[]{PERCENT_VALUE_RANGE});
								dgrdData.Col = dgrdData.Columns.IndexOf(dgrdData.Columns[PO_InvoiceDetailTable.IMPORTTAX_FLD]);
								dgrdData.Focus();							
								blnResult = false;
							}
						}
					}
					break;

				case PO_InvoiceDetailTable.VAT_FLD:
					if(pstrColumValue.Length != 0)
					{
						//Check if invoice amount is a positive numeric
						if(!FormControlComponents.IsValidPercent(pstrColumValue))
						{
							//HACK: VAT may be zero
							decimal dblTempVAT = decimal.Zero; 
							try
							{
								dblTempVAT = decimal.Parse(pstrColumValue);
							}
							catch
							{
								dblTempVAT = decimal.MinusOne;
							}
								
							if(dblTempVAT != decimal.Zero)
							{									
								PCSMessageBox.Show(ErrorCode.MESSAGE_C1NUMBER_INPUT_VALUE, MessageBoxIcon.Exclamation, new string[]{PERCENT_VALUE_RANGE});
								dgrdData.Col = dgrdData.Columns.IndexOf(dgrdData.Columns[PO_InvoiceDetailTable.VAT_FLD]);
								dgrdData.Focus();
								blnResult = false;
							}
							//End hack
						}
					}
					break;

				case PO_InvoiceDetailTable.INLAND_FLD:
					if(pstrColumValue.Length != 0)
					{
						//Check if invoice amount is a positive numeric
						if(!FormControlComponents.IsPositiveNumeric(pstrColumValue) && !pstrColumValue.Equals(ZERO_STRING))
						{
							PCSMessageBox.Show(ErrorCode.MESSAGE_OUTPROCESSING_INVALID_NUMBER, MessageBoxIcon.Exclamation);
							dgrdData.Col = dgrdData.Columns.IndexOf(dgrdData.Columns[PO_InvoiceDetailTable.INLAND_FLD]);
							dgrdData.Focus();
							blnResult = false;
						}
					}						
					break;
			}

			return blnResult;
		}
		

		/// <summary>
		/// Calculate data in the grid
		/// </summary>
		/// <param name="pstrColumnName"></param>
		private void CalculateDataInGrid(string pstrColumnName)
		{
			//Get actual number of rows
			int intRowCount = GetActualRowCount(dtbDetail);

			//Check for each column
			switch (pstrColumnName)
			{
				case PO_InvoiceDetailTable.INVOICEQUANTITY_FLD:
					//User enter Unit Price (system do not allow user Price < 0)
					//Update value for CIF Amount = Quantity * Unit Price; System update Total CIF Amount
					CalculateCIFAmount();
					CalculateImportAmount();
					CalculateBeforeVATAmount();
					CalculateVATAmount();
					CalculateCIPAmount();
					break;
					
				case PO_InvoiceDetailTable.UNITPRICE_FLD:
					//User enter Unit Price (system do not allow user Price < 0)
					//Update value for CIF Amount = Quantity * Unit Price; System update Total CIF Amount
					CalculateCIFAmount();
					CalculateImportAmount();
					CalculateBeforeVATAmount();
					CalculateVATAmount();
					CalculateCIPAmount();
					break;

				case PO_InvoiceDetailTable.IMPORTTAX_FLD:
					//31. System auto update value for Imp Amount
					//32. System auto update value for Before VAT = CIF Amount + Imp Amount
					CalculateImportAmount();
					CalculateBeforeVATAmount();
					CalculateVATAmount();
					CalculateCIPAmount();
					break;

				case PO_InvoiceDetailTable.VAT_FLD:
					//System auto update value for VAT Amount = Before VAT * 0.01 * % VAT;
					CalculateVATAmount();
					CalculateCIPAmount();
					break;

				case PO_InvoiceDetailTable.INLAND_FLD:
					//System auto update value for CIP = CIF + Inland;
					CalculateCIPAmount();
					break;
			}
			//Update total						
			CalculateTotalImportAmount(intRowCount);
			CalculateTotalBeforeVATAmount(intRowCount);
			CalculateTotalVATAmount(intRowCount);
			CalculateTotalCIPAmount(intRowCount);
			CalculateTotalCIFAmount(intRowCount);
			CalculateTotalInlandAmount(intRowCount);
		}
		
		/// <summary>
		/// Get max Invoice Line number
		/// </summary>
		/// <returns></returns>
		private int GetMaxLineInGrid(int pintRowCount)
		{
			try
			{
				int intMaxLine = 0;
				for(int i = 0; i < pintRowCount; i++)
				{					
					if(!dgrdData[i, PO_InvoiceDetailTable.INVOICELINE_FLD].Equals(DBNull.Value)
						&& !dgrdData[i, PO_InvoiceDetailTable.INVOICELINE_FLD].ToString().Equals(string.Empty))
					{
						int itemp = int.Parse(dgrdData[i, PO_InvoiceDetailTable.INVOICELINE_FLD].ToString());
						if(intMaxLine < itemp)
						{
							intMaxLine = itemp;
						}
					}
				}

				return intMaxLine;
			}
			catch (Exception ex)
			{
				throw new Exception(ex.Message, ex);
			}
		}
		
		private bool IsDuplicateData(string pstrPOMasterID, string pstrPODetailID, string pstrDeliveryID, int pintRowCount)
		{
			//int intRowCount = GetActualRowCount(dtbDetail);

			for(int i = 0; i< pintRowCount - 1; i++)
			{
				if( dgrdData[i, PO_PurchaseOrderMasterTable.PURCHASEORDERMASTERID_FLD].ToString() == pstrPOMasterID
					&& dgrdData[i, PO_PurchaseOrderDetailTable.PURCHASEORDERDETAILID_FLD].ToString() == pstrPODetailID
					&& dgrdData[i, PO_DeliveryScheduleTable.DELIVERYSCHEDULEID_FLD].ToString() == pstrDeliveryID)
					return true;
			}

			return false;			
		}
		
		/// <summary>
		/// Add selected rows into data grid
		/// </summary>
		/// <param name="htbData"></param>
		private void AddSelectedData2DataGrid(Hashtable htbData)
		{			
			if(htbData == null) return;
				
			//Get actual number of rows
			int intRowCount = GetActualRowCount(dtbDetail);

			//get max line
			int intMaxLine = GetMaxLineInGrid(intRowCount);
				
			CurrencyManager currencyManger;
			currencyManger = (CurrencyManager) dgrdData.BindingContext[dgrdData.DataSource];				
			dgrdData.Focus();
				
			//not duplicate --> insert into grid
			dgrdData.EditActive = true;

			//loop through selected rows
			for(int i = 0; i< htbData.Count; i++)
			{					
				DataRow drowSourceData = (DataRow)htbData[i];												
					
				//Check if selected row is duplicated
				bool blnDuplicate = IsDuplicateData(drowSourceData[PO_PurchaseOrderMasterTable.PURCHASEORDERMASTERID_FLD].ToString(),
					drowSourceData[PO_PurchaseOrderDetailTable.PURCHASEORDERDETAILID_FLD].ToString(),
					drowSourceData[PO_DeliveryScheduleTable.DELIVERYSCHEDULEID_FLD].ToString(), intRowCount);
				if(blnDuplicate)
					continue;

				currencyManger.AddNew();					
				dgrdData.Row = intMaxLine;	
					
				//Increase row count
				intRowCount++;

				dgrdData[dgrdData.Row, PO_InvoiceDetailTable.INVOICELINE_FLD] = ++intMaxLine;					 
				dgrdData[dgrdData.Row, PO_InvoiceDetailTable.INVOICEMASTERID_FLD] = voMaster.InvoiceMasterID;
				dgrdData[dgrdData.Row, PO_PurchaseOrderMasterTable.TABLE_NAME + PO_PurchaseOrderMasterTable.CODE_FLD] = drowSourceData[PO_PurchaseOrderMasterTable.TABLE_NAME + PO_PurchaseOrderMasterTable.CODE_FLD];
				dgrdData[dgrdData.Row, PO_PurchaseOrderDetailTable.TABLE_NAME + PO_PurchaseOrderDetailTable.LINE_FLD] = drowSourceData[PO_PurchaseOrderDetailTable.TABLE_NAME + PO_PurchaseOrderDetailTable.LINE_FLD];
				dgrdData[dgrdData.Row, PO_DeliveryScheduleTable.DELIVERYLINE_FLD] = drowSourceData[PO_DeliveryScheduleTable.DELIVERYLINE_FLD];
				dgrdData[dgrdData.Row, ITM_ProductTable.TABLE_NAME + ITM_ProductTable.CODE_FLD] = drowSourceData[ITM_ProductTable.TABLE_NAME + ITM_ProductTable.CODE_FLD];
				dgrdData[dgrdData.Row, ITM_ProductTable.TABLE_NAME + ITM_ProductTable.DESCRIPTION_FLD] = drowSourceData[ITM_ProductTable.TABLE_NAME + ITM_ProductTable.DESCRIPTION_FLD];
				dgrdData[dgrdData.Row, ITM_ProductTable.TABLE_NAME + ITM_ProductTable.REVISION_FLD] = drowSourceData[ITM_ProductTable.TABLE_NAME + ITM_ProductTable.REVISION_FLD];
				dgrdData[dgrdData.Row, ITM_ProductTable.TAXCODE_FLD] = drowSourceData[ITM_ProductTable.TAXCODE_FLD];
				dgrdData[dgrdData.Row, PO_InvoiceDetailTable.INVOICEQUANTITY_FLD] = drowSourceData[PO_DeliveryScheduleTable.DELIVERYQUANTITY_FLD];
				dgrdData[dgrdData.Row, PO_InvoiceDetailTable.UNITPRICE_FLD] = drowSourceData[PO_PurchaseOrderDetailTable.TABLE_NAME + PO_PurchaseOrderDetailTable.UNITPRICE_FLD];
				dgrdData[dgrdData.Row, MST_UnitOfMeasureTable.TABLE_NAME + MST_UnitOfMeasureTable.CODE_FLD] = drowSourceData[MST_UnitOfMeasureTable.TABLE_NAME + MST_UnitOfMeasureTable.CODE_FLD];					
				dgrdData[dgrdData.Row, PO_InvoiceDetailTable.IMPORTTAX_FLD] = drowSourceData[PO_PurchaseOrderDetailTable.TABLE_NAME + PO_PurchaseOrderDetailTable.IMPORTTAX_FLD];					
				dgrdData[dgrdData.Row, PO_InvoiceDetailTable.VAT_FLD] = drowSourceData[PO_PurchaseOrderDetailTable.TABLE_NAME + PO_PurchaseOrderDetailTable.VAT_FLD];					
				dgrdData[dgrdData.Row, ITM_ProductTable.OTHERINFO1_FLD]  = drowSourceData[ITM_ProductTable.OTHERINFO1_FLD];
				dgrdData[dgrdData.Row, ITM_ProductTable.PARTNAMEVN_FLD] = drowSourceData[ITM_ProductTable.PARTNAMEVN_FLD];
				dgrdData[dgrdData.Row, PO_InvoiceDetailTable.NOTE_FLD] = string.Empty;
				dgrdData[dgrdData.Row, PO_InvoiceDetailTable.PRODUCTID_FLD] = drowSourceData[PO_InvoiceDetailTable.PRODUCTID_FLD];
				dgrdData[dgrdData.Row, PO_InvoiceDetailTable.PURCHASEORDERMASTERID_FLD] = drowSourceData[PO_PurchaseOrderMasterTable.PURCHASEORDERMASTERID_FLD];
				dgrdData[dgrdData.Row, PO_InvoiceDetailTable.PURCHASEORDERDETAILID_FLD] = drowSourceData[PO_PurchaseOrderDetailTable.PURCHASEORDERDETAILID_FLD];
				dgrdData[dgrdData.Row, PO_InvoiceDetailTable.DELIVERYSCHEDULEID_FLD] = drowSourceData[PO_DeliveryScheduleTable.DELIVERYSCHEDULEID_FLD];
				dgrdData[dgrdData.Row, PO_InvoiceDetailTable.INVOICEUMID_FLD] = drowSourceData[PO_PurchaseOrderDetailTable.BUYINGUMID_FLD];
				dgrdData[dgrdData.Row, MST_PartyTable.TABLE_NAME + MST_PartyTable.CODE_FLD] = drowSourceData[MST_PartyTable.TABLE_NAME + MST_PartyTable.CODE_FLD];
					
				dgrdData[dgrdData.Row, PO_DeliveryScheduleTable.RECEIVEDQUANTITY_FLD] = drowSourceData[PO_DeliveryScheduleTable.RECEIVEDQUANTITY_FLD];
					
				dgrdData[dgrdData.Row, PO_InvoiceDetailTable.INLAND_FLD] = Decimal.Zero;
				//dgrdData.UpdateData();

				//Update value of calculated-fields
				decimal decValue1 = Decimal.Zero;
				decimal decValue2 = Decimal.Zero;

				//CIF Amount = Quantity * Unit Price
				if(!dgrdData[dgrdData.Row, PO_InvoiceDetailTable.INVOICEQUANTITY_FLD].Equals(DBNull.Value)
					&& !dgrdData[dgrdData.Row, PO_InvoiceDetailTable.INVOICEQUANTITY_FLD].ToString().Equals(string.Empty))
				{
					decValue1 = decimal.Parse(dgrdData[dgrdData.Row, PO_InvoiceDetailTable.INVOICEQUANTITY_FLD].ToString());
				}

				if(!dgrdData[dgrdData.Row, PO_InvoiceDetailTable.UNITPRICE_FLD].Equals(DBNull.Value)
					&& !dgrdData[dgrdData.Row, PO_InvoiceDetailTable.UNITPRICE_FLD].ToString().Equals(string.Empty))
				{
					decValue2 = decimal.Parse(dgrdData[dgrdData.Row, PO_InvoiceDetailTable.UNITPRICE_FLD].ToString());
				}
				dgrdData[dgrdData.Row, PO_InvoiceDetailTable.CIFAMOUNT_FLD] = decValue1 * decValue2;					
					
				//----------------------------------------------------------------------
				decValue1 *= decValue2; // = CIF Amount, see line above

				//----------------------------------------------------------------------					
				if(!dgrdData[dgrdData.Row, PO_InvoiceDetailTable.INLAND_FLD].Equals(DBNull.Value)
					&& !dgrdData[dgrdData.Row, PO_InvoiceDetailTable.INLAND_FLD].ToString().Equals(string.Empty))
				{
					decValue2 = decimal.Parse(dgrdData[dgrdData.Row, PO_InvoiceDetailTable.INLAND_FLD].ToString());
				}
				else
				{
					decValue2 = Decimal.Zero;
				}
				//CIP = CIF + Inland
				dgrdData[dgrdData.Row, PO_InvoiceDetailTable.CIPAMOUNT_FLD] = decValue1 + decValue2;

				//Now decValue1 = CIF Amount
				if(!dgrdData[dgrdData.Row, PO_InvoiceDetailTable.IMPORTTAX_FLD].Equals(DBNull.Value)
					&& !dgrdData[dgrdData.Row, PO_InvoiceDetailTable.IMPORTTAX_FLD].ToString().Equals(string.Empty))
				{
					decValue2 = decimal.Parse(dgrdData[dgrdData.Row, PO_InvoiceDetailTable.IMPORTTAX_FLD].ToString());
				}
				else
				{
					decValue2 = Decimal.Zero;						
				}

				//Imp Amount = CIF Amount * 0.01 * % Imp
				dgrdData[dgrdData.Row, PO_InvoiceDetailTable.IMPORTTAXAMOUNT_FLD] = decValue1 * (decimal)0.01 * decValue2;
					
				//----------------------------------------------------------------------
				decValue2 = decValue1 * (decimal)0.01 * decValue2;// = Import Amount, see line above					
					
				//Before VAT = CIF Amount + Imp Amount
				dgrdData[dgrdData.Row, PO_InvoiceDetailTable.BEFOREVATAMOUNT_FLD] = decValue1 + decValue2;
					
				//----------------------------------------------------------------------
				decValue1 += decValue2;// = Before VAT Amount, see line above.

				if(!dgrdData[dgrdData.Row, PO_InvoiceDetailTable.VAT_FLD].Equals(DBNull.Value)
					&& !dgrdData[dgrdData.Row, PO_InvoiceDetailTable.VAT_FLD].ToString().Equals(string.Empty))
				{
					decValue2 = decimal.Parse(dgrdData[dgrdData.Row, PO_InvoiceDetailTable.VAT_FLD].ToString());
				}
				else
				{
					decValue2 = Decimal.Zero;
				}

				//VAT Amount = Before VAT * 0.01 * % VAT
				dgrdData[dgrdData.Row, PO_InvoiceDetailTable.VATAMOUNT_FLD] = decValue1 * (decimal)0.01 * decValue2;
				dgrdData[dgrdData.Row, ITM_ProductTable.TABLE_NAME + ITM_ProductTable.QASTATUS_FLD] = drowSourceData[ITM_ProductTable.TABLE_NAME + ITM_ProductTable.QASTATUS_FLD];

				// QAStatus
				int intQAStatus = Convert.ToInt32(drowSourceData[ITM_ProductTable.TABLE_NAME + ITM_ProductTable.QASTATUS_FLD]);
				if (intQAStatus == (int)EnumQA.NOT_REQUIRE_INSPECTION)
					dgrdData[dgrdData.Row, PO_InvoiceDetailTable.QASTATUS_FLD] = (int)QAStatusEnum.Passed;
				else
					dgrdData[dgrdData.Row, PO_InvoiceDetailTable.QASTATUS_FLD] = (int)QAStatusEnum.Unknow;
			}

			currencyManger = null;
			//Turn on EditActive status of grid
			dgrdData.EditActive = false;
			dgrdData.UpdateData();
			dgrdData.Refresh();
				
			//Get actual number of rows
			intRowCount = GetActualRowCount(dtbDetail);

			//Update total values
			CalculateTotalBeforeVATAmount(intRowCount);
			CalculateTotalCIFAmount(intRowCount);
			CalculateTotalCIPAmount(intRowCount);
			CalculateTotalInlandAmount(intRowCount);
			CalculateTotalImportAmount(intRowCount);
			CalculateTotalVATAmount(intRowCount);
		}

		/// <summary>
		/// Format grid
		/// </summary>
		private void FormatDataGrid()
		{
			string FORMAT_0000 = "00";
			//Restore layout
			FormControlComponents.RestoreGridLayout(dgrdData, dtbGridLayOut);
				
			//lock columns
			for(int i= 0; i < dgrdData.Splits[0].DisplayColumns.Count; i++)
			{
				dgrdData.Splits[0].DisplayColumns[i].Locked = true;
			}

			dgrdData.Splits[0].DisplayColumns[PO_InvoiceDetailTable.INVOICEQUANTITY_FLD].Locked = false;
			dgrdData.Splits[0].DisplayColumns[PO_InvoiceDetailTable.UNITPRICE_FLD].Locked = false;
			dgrdData.Splits[0].DisplayColumns[PO_InvoiceDetailTable.IMPORTTAX_FLD].Locked = false;
			dgrdData.Splits[0].DisplayColumns[PO_InvoiceDetailTable.VAT_FLD].Locked = false;
			dgrdData.Splits[0].DisplayColumns[PO_InvoiceDetailTable.INLAND_FLD].Locked = false;
			dgrdData.Splits[0].DisplayColumns[PO_InvoiceDetailTable.NOTE_FLD].Locked = false;
			dgrdData.Splits[0].DisplayColumns[PO_InvoiceDetailTable.NGQUANTITY_FLD].Locked = true;
			dgrdData.Splits[0].DisplayColumns[PO_InvoiceDetailTable.QASTATUS_FLD].Locked = true;
			#region thuypt request: allows user change everything in grid
			dgrdData.Splits[0].DisplayColumns[PO_InvoiceDetailTable.BEFOREVATAMOUNT_FLD].Locked = false;
			dgrdData.Splits[0].DisplayColumns[PO_InvoiceDetailTable.CIFAMOUNT_FLD].Locked = false;
			dgrdData.Splits[0].DisplayColumns[PO_InvoiceDetailTable.CIPAMOUNT_FLD].Locked = false;
			dgrdData.Splits[0].DisplayColumns[PO_InvoiceDetailTable.IMPORTTAXAMOUNT_FLD].Locked = false;
			dgrdData.Splits[0].DisplayColumns[PO_InvoiceDetailTable.VATAMOUNT_FLD].Locked = false;
			#endregion
			foreach (ValueItem vi in vQAStatus)
			{
				dgrdData.Columns[PO_InvoiceDetailTable.QASTATUS_FLD].ValueItems.Values.Add(vi);
			}
			dgrdData.Columns[PO_InvoiceDetailTable.QASTATUS_FLD].ValueItems.Presentation = PresentationEnum.SortedComboBox;
			dgrdData.Columns[PO_InvoiceDetailTable.QASTATUS_FLD].ValueItems.Translate = true;
			dgrdData.Splits[0].DisplayColumns[PO_InvoiceDetailTable.QASTATUS_FLD].Button = false;
				
			//assign editor to updatable coulumns
			dgrdData.Columns[PO_InvoiceDetailTable.INVOICEQUANTITY_FLD].Editor = numQuantity;
			dgrdData.Columns[PO_InvoiceDetailTable.NGQUANTITY_FLD].Editor = numQuantity;
			dgrdData.Columns[PO_InvoiceDetailTable.UNITPRICE_FLD].Editor = numValue;
			dgrdData.Columns[PO_InvoiceDetailTable.IMPORTTAX_FLD].Editor = numValue;
			dgrdData.Columns[PO_InvoiceDetailTable.VAT_FLD].Editor = numValue;
			dgrdData.Columns[PO_InvoiceDetailTable.INLAND_FLD].Editor = numValue;
		
			//Change display format of nummeric fields
			dgrdData.Columns[PO_InvoiceDetailTable.INVOICEQUANTITY_FLD].NumberFormat = Constants.DECIMAL_NUMBERFORMAT;
			dgrdData.Columns[PO_InvoiceDetailTable.NGQUANTITY_FLD].NumberFormat = Constants.DECIMAL_NUMBERFORMAT;
			dgrdData.Columns[PO_InvoiceDetailTable.UNITPRICE_FLD].NumberFormat = Constants.DECIMAL_NUMBERFORMAT+ FORMAT_0000;
			dgrdData.Columns[PO_InvoiceDetailTable.IMPORTTAX_FLD].NumberFormat = Constants.DECIMAL_NUMBERFORMAT;
			dgrdData.Columns[PO_InvoiceDetailTable.VAT_FLD].NumberFormat = Constants.DECIMAL_NUMBERFORMAT;
			dgrdData.Columns[PO_InvoiceDetailTable.INLAND_FLD].NumberFormat = Constants.DECIMAL_NUMBERFORMAT + FORMAT_0000;
			dgrdData.Columns[PO_InvoiceDetailTable.BEFOREVATAMOUNT_FLD].NumberFormat = Constants.DECIMAL_NUMBERFORMAT;
			dgrdData.Columns[PO_InvoiceDetailTable.CIFAMOUNT_FLD].NumberFormat = Constants.DECIMAL_NUMBERFORMAT + FORMAT_0000;
			dgrdData.Columns[PO_InvoiceDetailTable.CIPAMOUNT_FLD].NumberFormat = Constants.DECIMAL_NUMBERFORMAT + FORMAT_0000;
			dgrdData.Columns[PO_InvoiceDetailTable.IMPORTTAXAMOUNT_FLD].NumberFormat = Constants.DECIMAL_NUMBERFORMAT + FORMAT_0000;
			dgrdData.Columns[PO_InvoiceDetailTable.VATAMOUNT_FLD].NumberFormat = Constants.DECIMAL_NUMBERFORMAT + FORMAT_0000;

			numValue.FormatType = C1.Win.C1Input.FormatTypeEnum.CustomFormat;
			numValue.CustomFormat = Constants.DECIMAL_NUMBERFORMAT + FORMAT_0000;
		}
		
		/// <summary>
		/// Build structure of xx table for binding to grid
		/// </summary>
		/// <remarks>
		/// Structure of this table based on struct which be returned by calling
		/// xx.GetDetailByMaster() method.
		/// So we should keep them always are identical.
		/// </remarks>
		/// <returns>DataTable</returns>
		private DataTable BuildDetailTable()
		{
			//Create table
			DataTable dtbTmpDetail = new DataTable(PO_InvoiceDetailTable.TABLE_NAME);
				
			//Add columns				
			dtbTmpDetail.Columns.Add(PO_InvoiceDetailTable.INVOICEMASTERID_FLD, typeof(System.Int32));
			dtbTmpDetail.Columns.Add(PO_InvoiceDetailTable.INVOICEDETAILID_FLD, typeof(System.Int32));
			dtbTmpDetail.Columns.Add(PO_InvoiceDetailTable.INVOICELINE_FLD, typeof(System.Int32));
			dtbTmpDetail.Columns.Add(PO_PurchaseOrderMasterTable.TABLE_NAME + PO_PurchaseOrderMasterTable.CODE_FLD, typeof(System.String));
			dtbTmpDetail.Columns.Add(PO_PurchaseOrderDetailTable.TABLE_NAME + PO_PurchaseOrderDetailTable.LINE_FLD, typeof(System.Int32));				
			dtbTmpDetail.Columns.Add(PO_DeliveryScheduleTable.DELIVERYLINE_FLD, typeof(System.Int32)); 
			dtbTmpDetail.Columns.Add(ITM_ProductTable.TABLE_NAME + ITM_ProductTable.CODE_FLD, typeof(System.String));				
			dtbTmpDetail.Columns.Add(ITM_ProductTable.TABLE_NAME + ITM_ProductTable.DESCRIPTION_FLD, typeof(System.String));
			dtbTmpDetail.Columns.Add(ITM_ProductTable.TABLE_NAME + ITM_ProductTable.REVISION_FLD, typeof(System.String));
			dtbTmpDetail.Columns.Add(ITM_ProductTable.TAXCODE_FLD, typeof(System.String));
			dtbTmpDetail.Columns.Add(PO_InvoiceDetailTable.INVOICEQUANTITY_FLD, typeof(System.Decimal));
			dtbTmpDetail.Columns.Add(PO_InvoiceDetailTable.UNITPRICE_FLD, typeof(System.Decimal));
			dtbTmpDetail.Columns.Add(MST_UnitOfMeasureTable.TABLE_NAME + MST_UnitOfMeasureTable.CODE_FLD, typeof(System.String)); 
			dtbTmpDetail.Columns.Add(PO_InvoiceDetailTable.NGQUANTITY_FLD, typeof(decimal));
			dtbTmpDetail.Columns.Add(PO_InvoiceDetailTable.QASTATUS_FLD, typeof(int));
			dtbTmpDetail.Columns.Add(PO_InvoiceDetailTable.CIFAMOUNT_FLD, typeof(System.Decimal)); 
			dtbTmpDetail.Columns.Add(PO_InvoiceDetailTable.IMPORTTAX_FLD, typeof(System.Decimal)); 
			dtbTmpDetail.Columns.Add(PO_InvoiceDetailTable.IMPORTTAXAMOUNT_FLD, typeof(System.Decimal)); 				
			dtbTmpDetail.Columns.Add(PO_InvoiceDetailTable.BEFOREVATAMOUNT_FLD, typeof(System.Decimal)); 
			dtbTmpDetail.Columns.Add(PO_InvoiceDetailTable.VAT_FLD, typeof(System.Decimal)); 
			dtbTmpDetail.Columns.Add(PO_InvoiceDetailTable.VATAMOUNT_FLD, typeof(System.Decimal));				
			dtbTmpDetail.Columns.Add(PO_InvoiceDetailTable.INLAND_FLD, typeof(System.Decimal));
			dtbTmpDetail.Columns.Add(PO_InvoiceDetailTable.CIPAMOUNT_FLD, typeof(System.Decimal)); 
			dtbTmpDetail.Columns.Add(ITM_ProductTable.OTHERINFO1_FLD, typeof(System.String)); 
			dtbTmpDetail.Columns.Add(ITM_ProductTable.PARTNAMEVN_FLD, typeof(System.String)); 
			dtbTmpDetail.Columns.Add(PO_InvoiceDetailTable.NOTE_FLD, typeof(System.String));
			dtbTmpDetail.Columns.Add(MST_PartyTable.TABLE_NAME +  MST_PartyTable.CODE_FLD, typeof(System.String));
			dtbTmpDetail.Columns.Add(PO_DeliveryScheduleTable.RECEIVEDQUANTITY_FLD, typeof(System.Decimal));
			dtbTmpDetail.Columns.Add(PO_InvoiceDetailTable.PRODUCTID_FLD, typeof(System.Int32)); 
			dtbTmpDetail.Columns.Add(PO_InvoiceDetailTable.PURCHASEORDERMASTERID_FLD, typeof(System.Int32)); 
			dtbTmpDetail.Columns.Add(PO_InvoiceDetailTable.PURCHASEORDERDETAILID_FLD, typeof(System.Int32)); 
			dtbTmpDetail.Columns.Add(PO_InvoiceDetailTable.DELIVERYSCHEDULEID_FLD, typeof(System.Int32)); 
			dtbTmpDetail.Columns.Add(PO_InvoiceDetailTable.INVOICEUMID_FLD, typeof(System.Int32));
			dtbTmpDetail.Columns.Add(PO_PurchaseOrderDetailTable.APPROVALDATE_FLD, typeof(System.DateTime));
			dtbTmpDetail.Columns.Add(ITM_ProductTable.TABLE_NAME +  ITM_ProductTable.QASTATUS_FLD, typeof(int));
			return dtbTmpDetail;
		}

		/// <summary>
		/// Fill related data on controls when select Invoice
		/// </summary>
		/// <param name="pblnAlwaysShowDialog"></param>
		private bool SelectInvoice(string pstrMethodName, bool pblnAlwaysShowDialog)
		{
			Hashtable htbCriteria = new Hashtable();
			DataRowView drwResult = null;
				
			if(cboCCN.SelectedValue != null)
			{
				htbCriteria.Add(PO_InvoiceMasterTable.CCNID_FLD, cboCCN.SelectedValue);
			}
			else
			{
				htbCriteria.Add(PO_InvoiceMasterTable.CCNID_FLD, 0);
			}

			//Call OpenSearchForm for selecting MPS planning cycle
			drwResult = FormControlComponents.OpenSearchForm(DETAILED_INVOICE_MASTER_VIEW, PO_InvoiceMasterTable.INVOICENO_FLD, txtInvoiceNo.Text, htbCriteria, pblnAlwaysShowDialog);
				
			// If has Master location matched searching condition, fill values to form's controls
			if (drwResult != null)
			{
				//Assign value to VO object
				voMaster.InvoiceMasterID = int.Parse(drwResult[PO_InvoiceMasterTable.INVOICEMASTERID_FLD].ToString());
				voMaster.CCNID = int.Parse(drwResult[PO_InvoiceMasterTable.CCNID_FLD].ToString());
				voMaster.PostDate = DateTime.Parse(drwResult[PO_InvoiceMasterTable.POSTDATE_FLD].ToString());
				voMaster.CurrencyID = int.Parse(drwResult[PO_InvoiceMasterTable.CURRENCYID_FLD].ToString());
				voMaster.ExchangeRate = decimal.Parse(drwResult[PO_InvoiceMasterTable.EXCHANGERATE_FLD].ToString());
				voMaster.InvoiceNo = drwResult[PO_InvoiceMasterTable.INVOICENO_FLD].ToString();

				voMaster.TotalBeforeVATAmount = decimal.Parse(drwResult[PO_InvoiceMasterTable.TOTALBEFOREVATAMOUNT_FLD].ToString());
				voMaster.TotalCIPAmount = decimal.Parse(drwResult[PO_InvoiceMasterTable.TOTALCIPAMOUNT_FLD].ToString());
				voMaster.TotalCIFAmount = decimal.Parse(drwResult[PO_InvoiceMasterTable.TOTALCIFAMOUNT_FLD].ToString());
				voMaster.TotalImportTax = decimal.Parse(drwResult[PO_InvoiceMasterTable.TOTALIMPORTTAX_FLD].ToString());
				voMaster.TotalInlandAmount = decimal.Parse(drwResult[PO_InvoiceMasterTable.TOTALINLANDAMOUNT_FLD].ToString());
				voMaster.TotalVATAmount = decimal.Parse(drwResult[PO_InvoiceMasterTable.TOTALVATAMOUNT_FLD].ToString());					
				//Declare Date
				if(!drwResult[PO_InvoiceMasterTable.DECLARATIONDATE_FLD].Equals(DBNull.Value))
				{
					voMaster.DeclarationDate = DateTime.Parse(drwResult[PO_InvoiceMasterTable.DECLARATIONDATE_FLD].ToString());
					dtmDeclareDate.Value = voMaster.DeclarationDate;
				}
				else
				{
					dtmDeclareDate.Value = DBNull.Value;
				}
					
				//BL Date
				if(!drwResult[PO_InvoiceMasterTable.BLDATE_FLD].Equals(DBNull.Value))
				{
					voMaster.BLDate = DateTime.Parse(drwResult[PO_InvoiceMasterTable.BLDATE_FLD].ToString());
					dtmBLDate.Value = voMaster.BLDate;
				}
				else
				{
					dtmBLDate.Value = DBNull.Value;
				}

				//Inform Date
				if(!drwResult[PO_InvoiceMasterTable.INFORMDATE_FLD].Equals(DBNull.Value))
				{
					voMaster.InformDate = DateTime.Parse(drwResult[PO_InvoiceMasterTable.INFORMDATE_FLD].ToString());
					dtmInformDate.Value = voMaster.InformDate;
				}
				else
				{
					dtmInformDate.Value = DBNull.Value;
				}

				//Assign to controls
				dtmPostDate.Value = voMaster.PostDate;
				txtBLNo.Text = drwResult[PO_InvoiceMasterTable.BLNUMBER_FLD].ToString();
				txtDeclaredNo.Text = drwResult[PO_InvoiceMasterTable.TAXDECLARATIONNUMBER_FLD].ToString();
				txtTaxInformNo.Text = drwResult[PO_InvoiceMasterTable.TAXINFORMNUMBER_FLD].ToString();
				txtInvoiceNo.Text = drwResult[PO_InvoiceMasterTable.INVOICENO_FLD].ToString();
					
				txtCurrency.Text = drwResult[MST_CurrencyTable.TABLE_NAME + MST_CurrencyTable.CODE_FLD].ToString();
				txtCurrency.Tag = drwResult[PO_InvoiceMasterTable.CURRENCYID_FLD].ToString();
				numExchRate.Value = voMaster.ExchangeRate;
					
				//Delivery Terms
				if(!drwResult[PO_InvoiceMasterTable.DELIVERYTERMID_FLD].Equals(DBNull.Value))
				{
					txtDeliveryTerms.Text = drwResult[MST_DeliveryTermTable.TABLE_NAME + MST_DeliveryTermTable.CODE_FLD].ToString();
					txtDeliveryTerms.Tag = drwResult[MST_DeliveryTermTable.DELIVERYTERMID_FLD].ToString();
				}
				else
				{
					txtDeliveryTerms.Text = string.Empty;
					txtDeliveryTerms.Tag = ZERO_STRING;
				}
					
				//Pay Terms
				if(!drwResult[PO_InvoiceMasterTable.PAYMENTTERMID_FLD].Equals(DBNull.Value))
				{
					txtPayTerms.Text = drwResult[MST_PaymentTermTable.TABLE_NAME + MST_PaymentTermTable.CODE_FLD].ToString();
					txtPayTerms.Tag = drwResult[PO_InvoiceMasterTable.PAYMENTTERMID_FLD].ToString();
				}
				else
				{
					txtPayTerms.Text = string.Empty;
					txtPayTerms.Tag = ZERO_STRING;
				}
					
				//Carrier 
				if(!drwResult[PO_InvoiceMasterTable.CARRIERID_FLD].Equals(DBNull.Value))
				{
					txtCarrier.Text = drwResult[MST_CarrierTable.TABLE_NAME + MST_CarrierTable.CODE_FLD].ToString();
					txtCarrier.Tag = drwResult[PO_InvoiceMasterTable.CARRIERID_FLD].ToString();
				}
				else
				{
					txtCarrier.Text = string.Empty;
					txtCarrier.Tag = ZERO_STRING;
				}

				//txtTaxInformNo.Text = drwResult[PO_InvoiceMasterTable.BLNUMBER_FLD].ToString();
					
				txtVendor.Tag = drwResult[PO_InvoiceMasterTable.PARTYID_FLD];
				txtVendor.Text = drwResult[MST_PartyTable.TABLE_NAME + MST_PartyTable.CODE_FLD].ToString();
				txtVendorName.Text = drwResult[MST_PartyTable.TABLE_NAME + MST_PartyTable.NAME_FLD].ToString();                    
					
				//Total value
				numTotalBeforeVAT.Value = voMaster.TotalBeforeVATAmount;
				numTotalCIFAmount.Value = voMaster.TotalCIFAmount;
				numTotalCIPAmt.Value = voMaster.TotalCIPAmount;
				numTotalImpTax.Value = voMaster.TotalImportTax;
				numTotalInlandAmt.Value = voMaster.TotalInlandAmount;					
				numTotalVatAmount.Value = voMaster.TotalVATAmount;
					
				//Reset modify status
				txtInvoiceNo.Modified = false;					
			}
			else
			{
				if(!pblnAlwaysShowDialog)
				{
					txtInvoiceNo.Tag = ZERO_STRING;
					txtInvoiceNo.Focus();
					return false;
				}					
			}
				
			//Fill data from datarow to controls				
			LoadDetailGrid(voMaster.InvoiceMasterID);
			LockControl(true);
			btnCheckQA.Enabled = true;
			return true;
		}

		/// <summary>
		/// Fill exchange rate
		/// </summary>
		/// <param name="pintCurrencyId"></param>
		/// <param name="pdtmDate"></param>
		private void FillExchangeRate(int pintCurrencyId, DateTime pdtmDate)
		{
			const string METHOD_NAME = THIS + ".FillExchangeRate()";
			try				
			{
				if(pintCurrencyId == SystemProperty.DefaultCurrencyID)
				{
					numExchRate.Value = Decimal.One;
					numExchRate.Enabled = false;
					return;
				}

				MST_ExchangeRateVO voExchangeRate = (MST_ExchangeRateVO)boMaster.GetExchangeRate(pintCurrencyId, pdtmDate);
				//Have exchange rate
				if(voExchangeRate.ExchangeRateID > 0)
				{
					numExchRate.Value = voExchangeRate.Rate;
					//numExchRate.Enabled = false;
				}
				else if(pintCurrencyId > 0)
				{
					numExchRate.Value = DBNull.Value;
					//numExchRate.Enabled = true;
				}
				else
				{
					numExchRate.Value = DBNull.Value;
					//numExchRate.Enabled = false;
				}
				numExchRate.Enabled = true;
			}
			catch (PCSException ex)
			{
				throw new PCSException(ex.mCode, METHOD_NAME, ex);
			}
			catch (Exception ex)
			{
				throw new Exception(ex.Message, ex);
			}	
		}

		/// <summary>
		/// Fill related data on controls when select Currency
		/// </summary>
		/// <param name="pblnAlwaysShowDialog"></param>
		private bool SelectCurrency(string pstrMethodName, bool pblnAlwaysShowDialog)
		{
			try
			{				
				Hashtable htbCriteria = new Hashtable();
				DataRowView drwResult = null;			

				//Call OpenSearchForm for selecting MPS planning cycle
				drwResult = FormControlComponents.OpenSearchForm(MST_CurrencyTable.TABLE_NAME, MST_CurrencyTable.CODE_FLD, txtCurrency.Text, htbCriteria, pblnAlwaysShowDialog);
				
				// If has Master location matched searching condition, fill values to form's controls
				if (drwResult != null)
				{
					//Check if data was changed then reassign
					txtCurrency.Text = drwResult[MST_CurrencyTable.CODE_FLD].ToString();
					txtCurrency.Tag = drwResult[MST_CurrencyTable.CURRENCYID_FLD];
					if(!dtmPostDate.ValueIsDbNull)
					{
						FillExchangeRate(int.Parse(txtCurrency.Tag.ToString()), DateTime.Parse(dtmPostDate.Value.ToString()));
					}
					else
					{
						FillExchangeRate(0, DateTime.Now);
					}

					//Reset modify status
					txtCurrency.Modified = false;
				}
				else
				{
					if(!pblnAlwaysShowDialog)
					{
						txtCurrency.Tag = ZERO_STRING;
						txtCurrency.Focus();
						return false;
					}					
				}

				return true;
			}
			catch (PCSException ex)
			{
				throw new PCSException(ex.mCode, pstrMethodName, ex);
			}
			catch (Exception ex)
			{
				throw new Exception(ex.Message, ex);
			}	
		}


		/// <summary>
		/// Fill related data on controls when select Vendor Code
		/// </summary>
		/// <param name="pblnAlwaysShowDialog"></param>
		private bool SelectVendorCode(string pstrMethodName, bool pblnAlwaysShowDialog)
		{
			try				
			{
				Hashtable htbCriteria = new Hashtable();
				DataRowView drwResult = null;				
				
				htbCriteria.Add(VENDOR_COLUMN, 1);

				//Call OpenSearchForm for selecting MPS planning cycle
				drwResult = FormControlComponents.OpenSearchForm(VENDOR_CUSTOMER_VIEW, MST_PartyTable.CODE_FLD, txtVendor.Text, htbCriteria, pblnAlwaysShowDialog);
				
				// If has Master location matched searching condition, fill values to form's controls
				if (drwResult != null)
				{
					if(!txtVendor.Tag.Equals(drwResult[MST_PartyTable.PARTYID_FLD]))
					{
						ClearGrid();
					}

					txtVendor.Text = drwResult[MST_PartyTable.CODE_FLD].ToString();
					txtVendorName.Text = drwResult[MST_PartyTable.NAME_FLD].ToString();
					txtVendor.Tag = drwResult[MST_PartyTable.PARTYID_FLD];

					//Reset modify status
					txtVendor.Modified = false;
					txtVendorName.Modified = false;
				}
				else
				{
					if(!pblnAlwaysShowDialog)
					{
						txtVendor.Tag = ZERO_STRING;
						txtVendor.Focus();

						return false;
					}					
				}
				return true;
			}
			catch(PCSException ex)
			{
				throw new PCSException(ex.mCode, pstrMethodName, ex);
			}
			catch (Exception ex)
			{
				throw new Exception(ex.Message, ex);
			}	
		}


		/// <summary>
		/// Fill related data on controls when select Vendor Name
		/// </summary>
		/// <param name="pblnAlwaysShowDialog"></param>
		private bool SelectVendorName(string pstrMethodName, bool pblnAlwaysShowDialog)
		{
			try				
			{
				Hashtable htbCriteria = new Hashtable();
				DataRowView drwResult = null;
				
				htbCriteria.Add(VENDOR_COLUMN, 1);
				
				//Call OpenSearchForm for selecting MPS planning cycle
				drwResult = FormControlComponents.OpenSearchForm(VENDOR_CUSTOMER_VIEW, MST_PartyTable.NAME_FLD, txtVendorName.Text, htbCriteria, pblnAlwaysShowDialog);
				
				// If has Master location matched searching condition, fill values to form's controls
				if (drwResult != null)
				{
					if(!txtVendor.Tag.Equals(drwResult[MST_PartyTable.PARTYID_FLD]))
					{
						ClearGrid();
					}

					txtVendorName.Text = drwResult[MST_PartyTable.NAME_FLD].ToString();
					txtVendor.Text = drwResult[MST_PartyTable.CODE_FLD].ToString();
					txtVendor.Tag = drwResult[MST_PartyTable.PARTYID_FLD];					

					//Reset modify status
					txtVendorName.Modified = false;
					txtVendor.Modified = false;
				}
				else
				{
					if(!pblnAlwaysShowDialog)
					{
						txtVendorName.Tag = ZERO_STRING;
						txtVendorName.Focus();

						return false;
					}
				}

				return true;
			}
			catch (PCSException ex)
			{
				throw new PCSException(ex.mCode, pstrMethodName, ex);
			}
			catch (Exception ex)
			{
				throw new Exception(ex.Message, ex);
			}	
		}

		/// <summary>
		/// Fill related data on controls when select Delivery Terms
		/// </summary>
		/// <param name="pblnAlwaysShowDialog"></param>
		private bool SelectDeliveryTerm(string pstrMethodName, bool pblnAlwaysShowDialog)
		{
			try
			{
				

				Hashtable htbCriteria = new Hashtable();
				DataRowView drwResult = null;		
				
				//Call OpenSearchForm for selecting MPS planning cycle
				drwResult = FormControlComponents.OpenSearchForm(MST_DeliveryTermTable.TABLE_NAME, MST_DeliveryTermTable.CODE_FLD, txtDeliveryTerms.Text, htbCriteria, pblnAlwaysShowDialog);
				
				// If has Master location matched searching condition, fill values to form's controls
				if (drwResult != null)
				{
					txtDeliveryTerms.Text = drwResult[MST_DeliveryTermTable.CODE_FLD].ToString();
					txtDeliveryTerms.Tag = drwResult[MST_DeliveryTermTable.DELIVERYTERMID_FLD];					
					
					//Reset modify status
					txtDeliveryTerms.Modified = false;
				}
				else
				{
					if(!pblnAlwaysShowDialog)
					{
						txtDeliveryTerms.Tag = ZERO_STRING;
						txtDeliveryTerms.Focus();
						return false;
					}					
				}

				return true;
			}
			catch (PCSException ex)
			{
				throw new PCSException(ex.mCode, pstrMethodName, ex);
			}
			catch (Exception ex)
			{
				throw new Exception(ex.Message, ex);
			}	
		}


		/// <summary>
		/// Fill related data on controls when select Payment Term
		/// </summary>
		/// <param name="pblnAlwaysShowDialog"></param>
		private bool SelectPaymentTerm(string pstrMethodName, bool pblnAlwaysShowDialog)
		{
			try				
			{
				

				Hashtable htbCriteria = new Hashtable();
				DataRowView drwResult = null;
				
				if(cboCCN.SelectedValue != null)
				{
					htbCriteria.Add(MST_PaymentTermTable.CCNID_FLD, cboCCN.SelectedValue);
				}
				else
				{
					htbCriteria.Add(MST_PaymentTermTable.CCNID_FLD, 0);
				}

				//Call OpenSearchForm for selecting MPS planning cycle
				drwResult = FormControlComponents.OpenSearchForm(MST_PaymentTermTable.TABLE_NAME, MST_PaymentTermTable.CODE_FLD, txtPayTerms.Text, htbCriteria, pblnAlwaysShowDialog);
				
				// If has Master location matched searching condition, fill values to form's controls
				if (drwResult != null)
				{					
					txtPayTerms.Text = drwResult[MST_PaymentTermTable.CODE_FLD].ToString();
					txtPayTerms.Tag = drwResult[MST_PaymentTermTable.PAYMENTTERMID_FLD];					
					
					//Reset modify status
					txtPayTerms.Modified = false;					
				}
				else
				{
					if(!pblnAlwaysShowDialog)
					{
						txtPayTerms.Tag = ZERO_STRING;
						txtPayTerms.Focus();
						return false;
					}					
				}

				return true;
			}
			catch (PCSException ex)
			{
				throw new PCSException(ex.mCode, pstrMethodName, ex);
			}
			catch (Exception ex)
			{
				throw new Exception(ex.Message, ex);
			}	
		}

		
		/// <summary>
		/// Fill related data on controls when select Carrier
		/// </summary>
		/// <param name="pblnAlwaysShowDialog"></param>
		private bool SelectCarrier(string pstrMethodName, bool pblnAlwaysShowDialog)
		{
			try
			{
				

				Hashtable htbCriteria = new Hashtable();
				DataRowView drwResult = null;			

				//Call OpenSearchForm for selecting MPS planning cycle
				drwResult = FormControlComponents.OpenSearchForm(MST_CarrierTable.TABLE_NAME, MST_CarrierTable.CODE_FLD, txtCarrier.Text, htbCriteria, pblnAlwaysShowDialog);
				
				// If has Master location matched searching condition, fill values to form's controls
				if (drwResult != null)
				{
					//Check if data was changed then reassign
					txtCarrier.Text = drwResult[MST_CarrierTable.CODE_FLD].ToString();
					txtCarrier.Tag = drwResult[MST_CarrierTable.CARRIERID_FLD];
					
					//Reset modify status
					txtCarrier.Modified = false;	
				}
				else
				{
					if(!pblnAlwaysShowDialog)
					{
						txtCarrier.Tag = ZERO_STRING;
						txtCarrier.Focus();
						return false;
					}					
				}

				return true;
			}
			catch (PCSException ex)
			{
				throw new PCSException(ex.mCode, pstrMethodName, ex);
			}
			catch (Exception ex)
			{
				throw new Exception(ex.Message, ex);
			}	
		}

		
		#endregion Private Methods

		#region Event Processing
		
		private void btnClose_Click(object sender, System.EventArgs e)
		{
			this.Close();
		}		

		private void POInvoice_Load(object sender, EventArgs e)
		{
			const string METHOD_NAME = THIS + ".POInvoice_Load()";
			try
			{
				enuFormAction = EnumAction.Default;
				
				//Set form security
				Security objSecurity = new Security();
				this.Name = THIS;
				if (objSecurity.SetRightForUserOnForm(this, SystemProperty.UserName) == 0)
				{
					// You don't have the right to view this item
					PCSMessageBox.Show(ErrorCode.MESSAGE_YOU_HAVE_NO_RIGHT_TO_VIEW, MessageBoxIcon.Warning);
					this.Close();
					return;
				}

				//Load CCN and set default CCN
				UtilsBO boUtils = new UtilsBO();
				DataSet dstCCN = boUtils.ListCCN();				
				FormControlComponents.PutDataIntoC1ComboBox(cboCCN, dstCCN.Tables[MST_CCNTable.TABLE_NAME], MST_CCNTable.CODE_FLD, MST_CCNTable.CCNID_FLD, MST_CCNTable.TABLE_NAME);
				
				//Set default CCN for CNN combobox
				if (SystemProperty.CCNID != 0)
				{
					cboCCN.SelectedValue = SystemProperty.CCNID;
				}
				else
				{
					cboCCN.SelectedIndex = 0;
				}
				
				vQAStatus = dgrdData.Columns[PO_InvoiceDetailTable.QASTATUS_FLD].ValueItems.Values;
				//get grid layout
				dtbGridLayOut = FormControlComponents.StoreGridLayout(dgrdData);

				//Clear controls value and lock for editing				
				ResetControlValue(enuFormAction);											

				LockControl(true);

				/// HACKED: Thachnn: 06/06/2006 Report COnfiguration
				/// REVIEW: these lines need to be call automatically in the Formload Section, not manual like this point
				this.btnPrintConfiguration.Click += new EventHandler(FormControlComponents.ShowMenuReportListHandler);
				this.btnPrint.Click += new EventHandler(FormControlComponents.RunDefaultReportEntriesHandler);				
				/// ENDHACKED: Thachnn: 06/06/2006 Report COnfiguration
			}
			catch (PCSException ex)
			{
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
				}
			}
		}

		private void POInvoice_KeyDown(object sender, KeyEventArgs e)
		{
			const string METHOD_NAME = THIS + ".POInvoice_KeyDown()";

			try
			{
				
				switch (e.KeyCode)
				{
					case Keys.F12:					
						//if column's value then exit immediately
						if(enuFormAction == EnumAction.Default) return;

						//Get actual number of rows
						int intRowCount = GetActualRowCount(dtbDetail);

						dgrdData.Col = dgrdData.Columns.IndexOf(dgrdData.Columns[PO_PurchaseOrderMasterTable.TABLE_NAME + PO_PurchaseOrderMasterTable.CODE_FLD]);
						dgrdData.Row = intRowCount;
						dgrdData.Focus();
						break;					
				}
			}
			catch(PCSException ex)
			{
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
			catch(Exception ex)
			{
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
		}

		private void POInvoice_Closing(object sender, System.ComponentModel.CancelEventArgs e)
		{
			const string METHOD_NAME = THIS + ".POInvoice_Closing()";
			try
			{	
				// if the form has been changed then ask to store database
				if(enuFormAction != EnumAction.Default) 
				{
					DialogResult enumDialog = PCSMessageBox.Show(ErrorCode.MESSAGE_QUESTION_STORE_INTO_DATABASE,MessageBoxButtons.YesNoCancel,MessageBoxIcon.Question);
					if( enumDialog == DialogResult.Yes)
					{
						btnSave_Click(sender, e);
						e.Cancel = !blnDataIsValid;
					}
					else if( enumDialog == DialogResult.Cancel)//click Cancel button
					{
						e.Cancel = true;
					}
				}				
			}
			catch (PCSException ex)
			{
				// Displays the error message if throwed from PCSException.
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					// Log error message into log file.
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					// Show message if logger has an error.
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				// Displays the error message if throwed from system.
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxIcon.Error);
				try
				{
					// Log error message into log file.
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					// Show message if logger has an error.
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxIcon.Error);
				}
			}
		}		
		

		private void btnCurrency_Click(object sender, System.EventArgs e)
		{
			const string METHOD_NAME = THIS + ".btnCurrency_Click()";
			try
			{
				SelectCurrency(METHOD_NAME, true);
			}
			catch (PCSException ex)
			{
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
		}

		private void btnVendor_Click(object sender, System.EventArgs e)
		{
			const string METHOD_NAME = THIS + ".btnVendor_Click()";
			try
			{
				SelectVendorCode(METHOD_NAME, true);
			}
			catch (PCSException ex)
			{
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
		}

		private void btnVendorName_Click(object sender, System.EventArgs e)
		{
			const string METHOD_NAME = THIS + ".btnVendorName_Click()";
			try
			{
				SelectVendorName(METHOD_NAME, true);
			}
			catch (PCSException ex)
			{
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
		}

		private void btnDeliveryTerms_Click(object sender, System.EventArgs e)
		{
			const string METHOD_NAME = THIS + ".btnDeliveryTerms_Click()";
			try
			{
				SelectDeliveryTerm(METHOD_NAME, true);
			}
			catch (PCSException ex)
			{
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
		}

		private void btnPayTerms_Click(object sender, System.EventArgs e)
		{
			const string METHOD_NAME = THIS + ".btnPayTerms_Click()";
			try
			{
				SelectPaymentTerm(METHOD_NAME, true);
			}
			catch (PCSException ex)
			{
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
		}

		private void btnCarrier_Click(object sender, System.EventArgs e)
		{
			const string METHOD_NAME = THIS + ".btnCarrier_Click()";
			try
			{
				SelectCarrier(METHOD_NAME, true);
			}
			catch (PCSException ex)
			{
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
		}

		private void btnAdd_Click(object sender, System.EventArgs e)
		{
			const string METHOD_NAME = THIS + ".btnAdd_Click()";

			try
			{
				enuFormAction = EnumAction.Add;				
				ResetControlValue(enuFormAction);
				LockControl(false);
				dtmPostDate.Focus();
			}
			catch (Exception ex)
			{
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
		}

		private void btnSave_Click(object sender, System.EventArgs e)
		{
			const string METHOD_NAME = THIS + ".btnSave_Click()";

			try
			{
				if(Security.IsDifferencePrefix(this,lblInvoiceNo,txtInvoiceNo))
				{
					return;
				}

				// check data, if data is invalid then exit immediately
				blnDataIsValid = ValidateData() && !dgrdData.EditActive;
				if(!blnDataIsValid) return;
				//Reset Invoice line
				int iLineIndex = 0;
				foreach(DataRow drow in dtbDetail.Rows)
				{
					if(drow.RowState == DataRowState.Deleted) continue;

					drow[PO_InvoiceDetailTable.INVOICELINE_FLD] = ++iLineIndex;
				}

				//Assign value from controls to VO
				AssignControlValue2VO();
                List<PO_InvoiceDetail> listDetail = new List<PO_InvoiceDetail>();
                //foreach (DataRow dr in dtbDetail.Rows)
                //{
                //    PO_InvoiceDetail objDetail = new PO_InvoiceDetail();
                //    objDetail.BeforeVATAmount
                //}

				// check form action to save data
				switch(enuFormAction)
				{
					case EnumAction.Add:
						int intInvoiceID = 0;
						if(dtbDetail.DataSet != null)
						{
							intInvoiceID = boMaster.AddAndReturn(voMaster, dtbDetail.DataSet);							
						}
						else
						{
							DataSet dtsDC = new DataSet();
							dtsDC.Tables.Add(dtbDetail);
							intInvoiceID = boMaster.AddAndReturn(voMaster, dtsDC);							
						}

						voMaster.InvoiceMasterID = intInvoiceID;
						break;

					case EnumAction.Edit:
					
						if(dtbDetail.DataSet != null)
						{
							boMaster.Update(voMaster, dtbDetail.DataSet);
						}
						else
						{
							DataSet dtsDC = new DataSet();
							dtsDC.Tables.Add(dtbDetail);
							boMaster.Update(voMaster, dtsDC);
						}						
						break;
				}

				//Reload detail grid				
				LoadDetailGrid(voMaster.InvoiceMasterID);				
				enuFormAction = EnumAction.Default;			

				//Update edit user
				Security.UpdateUserNameModifyTransaction(this, PO_InvoiceMasterTable.INVOICEMASTERID_FLD, voMaster.InvoiceMasterID);
				
				//Lock controls
				LockControl(true);

				txtInvoiceNo.Enabled = true;
				
				//Show sucessful message
				PCSMessageBox.Show(ErrorCode.MESSAGE_AFTER_SAVE_DATA, MessageBoxButtons.OK, MessageBoxIcon.Information);
				
			}
			catch (PCSException ex)
			{
				blnDataIsValid = false;
				if (ex.mCode == ErrorCode.DUPLICATE_KEY)
				{
					PCSMessageBox.Show(ErrorCode.MESSAGE_OUTPROCESSING_DUPLICATE_TRANSNO, MessageBoxIcon.Exclamation);
					txtInvoiceNo.Focus();
				}
				else
				{				
					PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
					try
					{
						Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
					}
					catch
					{
						PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
					}
				}
			}
			catch (Exception ex)
			{
				blnDataIsValid = false;
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
		}

		private void btnEdit_Click(object sender, System.EventArgs e)
		{
			const string METHOD_NAME = THIS + ".btnEdit_Click()";
			try
			{
//				if(Security.NoRightToEditTransaction(this, PO_InvoiceMasterTable.INVOICEMASTERID_FLD, voMaster.InvoiceMasterID))
//				{
//					return;
//				}
				//return if user has not select DC Option
				if(voMaster.InvoiceMasterID == 0 ) return;

				enuFormAction = EnumAction.Edit;
				LockControl(false);
				dtmPostDate.Focus();
			}
			catch (Exception ex)
			{
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
		}

		private void btnDelete_Click(object sender, System.EventArgs e)
		{
			const string METHOD_NAME = THIS + ".btnDelete_Click()";

			try
			{
				//Check right
				if(Security.NoRightToDeleteTransaction(this, PO_InvoiceMasterTable.INVOICEMASTERID_FLD, voMaster.InvoiceMasterID))
				{
					return;
				}

				if(voMaster.InvoiceMasterID == 0)
				{ 
					return;
				}

				if (PCSMessageBox.Show(ErrorCode.MESSAGE_DELETE_RECORD, MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question) == DialogResult.Yes)
				{
					if(dtbDetail.DataSet != null)
					{
						boMaster.Delete(voMaster, dtbDetail.DataSet);
					}
					else
					{
						DataSet dtsTemp = new DataSet();
						dtsTemp.Tables.Add(dtbDetail);
						boMaster.Delete(voMaster, dtsTemp);
					}

					ResetControlValue(EnumAction.Delete);					
					LockControl(true);
				}
			}
			catch (PCSException ex)
			{	
				//HACK: added by Tuan TQ. Fix error no. 3823
				try
				{
					LoadDetailGrid(voMaster.InvoiceMasterID);
				}
				catch{}
				//End hack

				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
				
			}
			catch (Exception ex)
			{
				//HACK: added by Tuan TQ. Fix error no. 3823
				try
				{
					LoadDetailGrid(voMaster.InvoiceMasterID);
				}
				catch{}
				//End hack

				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}

				
			}
		}


		private void btnHelp_Click(object sender, System.EventArgs e)
		{
		
		}

		
		private void txtCurrency_Validating(object sender, System.ComponentModel.CancelEventArgs e)
		{			
			const string METHOD_NAME = THIS + ".txtCurrency_Validating()";
			try
			{				
				//Exit immediately if empty or in default mode
				if(enuFormAction == EnumAction.Default) return;
				if(txtCurrency.Text.Length == 0)
				{
					txtCurrency.Tag = ZERO_STRING;
					if(!dtmPostDate.ValueIsDbNull)
					{
						FillExchangeRate(0, DateTime.Parse(dtmPostDate.Value.ToString()));
					}
					else
					{
						FillExchangeRate(0, DateTime.Now);
					}
					return;
				}
				else if(!txtCurrency.Modified)
				{
					return;
				}
				
				e.Cancel = !SelectCurrency(METHOD_NAME, false);
			}
			catch (PCSException ex)
			{
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
		}

		private void txtCurrency_KeyDown(object sender, KeyEventArgs e)
		{
			const string METHOD_NAME = THIS + ".txtCurrency_KeyDown()";

			try
			{
				if ((e.KeyCode == Keys.F4) && (btnCurrency.Enabled))
				{
					SelectCurrency(METHOD_NAME, true);
				}
			}
			catch (PCSException ex)
			{
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
		}

		private void txtCarrier_Validating(object sender, System.ComponentModel.CancelEventArgs e)
		{
			const string METHOD_NAME = THIS + ".txtCarrier_Validating()";
			try
			{				
				//Exit immediately if empty or in default mode
				if(enuFormAction == EnumAction.Default) return;
				if(txtCarrier.Text.Length == 0)
				{
					txtCarrier.Tag = ZERO_STRING;
					return;
				}
				else if(!txtCarrier.Modified)
				{
					return;
				}
				
				e.Cancel = !SelectCarrier(METHOD_NAME, false);
			}
			catch (PCSException ex)
			{
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
		}

		private void txtCarrier_KeyDown(object sender, KeyEventArgs e)
		{
			const string METHOD_NAME = THIS + ".txtCarrier_KeyDown()";

			try
			{
				if ((e.KeyCode == Keys.F4) && (btnCarrier.Enabled))
				{
					SelectCarrier(METHOD_NAME, true);
				}
			}
			catch (PCSException ex)
			{
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
		}

		private void txtPayTerms_Validating(object sender, System.ComponentModel.CancelEventArgs e)
		{
			const string METHOD_NAME = THIS + ".txtPayTerms_Validating()";
			try
			{				
				//Exit immediately if empty or in default mode
				if(enuFormAction == EnumAction.Default) return;
				if(txtPayTerms.Text.Length == 0)
				{
					return;
				}
				else if(!txtPayTerms.Modified)
				{
					return;
				}
				
				e.Cancel = !SelectPaymentTerm(METHOD_NAME, false);
			}
			catch (PCSException ex)
			{
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
		}

		private void txtPayTerms_KeyDown(object sender, KeyEventArgs e)
		{
			const string METHOD_NAME = THIS + ".txtPayTerms_KeyDown()";

			try
			{
				if ((e.KeyCode == Keys.F4) && (btnPayTerms.Enabled))
				{
					SelectPaymentTerm(METHOD_NAME, true);
				}
			}
			catch (PCSException ex)
			{
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
		}

		private void txtDeliveryTerms_Validating(object sender, System.ComponentModel.CancelEventArgs e)
		{
			const string METHOD_NAME = THIS + ".txtDeliveryTerms_Validating()";
			try
			{				
				//Exit immediately if empty or in default mode
				if(enuFormAction == EnumAction.Default) return;
				if(txtDeliveryTerms.Text.Length == 0)
				{
					return;
				}
				else if(!txtDeliveryTerms.Modified)
				{
					return;
				}
				
				e.Cancel = !SelectDeliveryTerm(METHOD_NAME, false);
			}
			catch (PCSException ex)
			{
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
		}

		private void txtDeliveryTerms_KeyDown(object sender, KeyEventArgs e)
		{
			const string METHOD_NAME = THIS + ".txtDeliveryTerms_KeyDown()";

			try
			{
				if ((e.KeyCode == Keys.F4) && (btnDeliveryTerms.Enabled))
				{
					SelectDeliveryTerm(METHOD_NAME, true);
				}
			}
			catch (PCSException ex)
			{
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
		}		

		private void txtVendor_Validating(object sender, System.ComponentModel.CancelEventArgs e)
		{
			const string METHOD_NAME = THIS + ".txtVendor_Validating()";
			try
			{
				//Exit immediately if empty or in default mode
				if(enuFormAction == EnumAction.Default) return;

				if(txtVendor.Text.Length == 0)
				{
					txtVendor.Tag = ZERO_STRING;
					txtVendorName.Text = string.Empty;
					return;
				}
				else if(!txtVendor.Modified)
				{
					return;
				}
				
				e.Cancel = !SelectVendorCode(METHOD_NAME, false);
			}
			catch (PCSException ex)
			{
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
		}

		private void txtVendor_KeyDown(object sender, KeyEventArgs e)
		{
			const string METHOD_NAME = THIS + ".txtVendor_KeyDown()";

			try
			{
				if ((e.KeyCode == Keys.F4) && (btnVendor.Enabled))
				{
					SelectVendorCode(METHOD_NAME, true);
				}
			}
			catch (PCSException ex)
			{
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
		}

		private void txtVendorName_Validating(object sender, System.ComponentModel.CancelEventArgs e)
		{
			const string METHOD_NAME = THIS + ".txtVendorName_Validating()";
			try
			{				
				//Exit immediately if empty or in default mode
				if(enuFormAction == EnumAction.Default) return;
				if(txtVendorName.Text.Length == 0)
				{
					txtVendor.Tag = ZERO_STRING;
					txtVendor.Text = string.Empty;
					return;
				}
				else if(!txtVendorName.Modified)
				{
					return;
				}
				
				e.Cancel = !SelectVendorName(METHOD_NAME, false);
			}
			catch (PCSException ex)
			{
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
		}

		private void txtVendorName_KeyDown(object sender, KeyEventArgs e)
		{
			const string METHOD_NAME = THIS + ".txtVendorName_KeyDown()";

			try
			{
				if ((e.KeyCode == Keys.F4) && (btnVendorName.Enabled))
				{
					SelectVendorName(METHOD_NAME, true);
				}
			}
			catch (PCSException ex)
			{
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
		}

		private void btnInvoiceNo_Click(object sender, System.EventArgs e)
		{
			const string METHOD_NAME = THIS + ".btnInvoiceNo_Click()";
			try
			{
				SelectInvoice(METHOD_NAME, true);
			}
			catch (PCSException ex)
			{
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
		}
		

		private void txtInvoiceNo_KeyDown(object sender, KeyEventArgs e)
		{
			const string METHOD_NAME = THIS + ".txtInvoiceNo_KeyDown()";

			try
			{
				if ((e.KeyCode == Keys.F4) && (btnInvoiceNo.Enabled))
				{
					SelectInvoice(METHOD_NAME, true);
				}
			}
			catch (PCSException ex)
			{
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
		}

		private void txtInvoiceNo_Validating(object sender, System.ComponentModel.CancelEventArgs e)
		{
			const string METHOD_NAME = THIS + ".txtInvoiceNo_Validating()";
			try
			{				
				//Exit immediately if empty or in default mode
				if(enuFormAction != EnumAction.Default) return;
				if(txtInvoiceNo.Text.Length == 0)
				{
					ResetControlValue(EnumAction.Default);
					return;
				}
				else if(!txtInvoiceNo.Modified)
				{
					return;
				}
				
				e.Cancel = !SelectInvoice(METHOD_NAME, false);
			}
			catch (PCSException ex)
			{
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
			catch (Exception ex)
			{
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
		}

		

		private void dgrdData_KeyDown(object sender, KeyEventArgs e)
		{
			const string METHOD_NAME = THIS + ".dgrdData_KeyDown()";

			try
			{
				//if column's value then exit immediately
				if(enuFormAction == EnumAction.Default) return;
				
				switch (e.KeyCode)
				{
					case Keys.F4:						
						ProcessInputDataInGrid(dgrdData.Columns[dgrdData.Col].DataField, dgrdData.Columns[dgrdData.Col].Value.ToString(), true);
						break;

						// HACK: Trada 23-02-2006
					case Keys.Delete:
						//HACK: added by Tuan TQ. 28 Mar, 2006
						if(dgrdData.SelectedRows.Count <= 0)
						{
							return;
						}
						//End hack

						int intReceiveQty = 0;
						try
						{
							int intSelectRows = dgrdData.SelectedRows.Count;
							//ArrayList intIndexOfSelectedRows = new ArrayList();
							for (int i =0; i < intSelectRows; i++)
							{
								//intIndexOfSelectedRows.Add(int.Parse(pdgrdData.SelectedRows[i].ToString()));
								int intRow = int.Parse(dgrdData.SelectedRows[i].ToString());
								intReceiveQty = Convert.ToInt32(dgrdData[intRow,PO_DeliveryScheduleTable.RECEIVEDQUANTITY_FLD]);
								if(intReceiveQty > 0)
								{
									return;
								}
							}
						}
						catch
						{}

						FormControlComponents.DeleteMultiRowsOnTrueDBGrid(dgrdData);
						//Get actual number of rows
						int intRowCount = GetActualRowCount(dtbDetail);

						//reset invoice line value
						for (int i = 0; i < intRowCount; i++)
						{
							dgrdData[i, PO_InvoiceDetailTable.INVOICELINE_FLD] = i + 1;
						}
							
						//Update total values
						CalculateTotalBeforeVATAmount(intRowCount);
						CalculateTotalCIFAmount(intRowCount);
						CalculateTotalCIPAmount(intRowCount);
						CalculateTotalInlandAmount(intRowCount);
						CalculateTotalImportAmount(intRowCount);
						CalculateTotalVATAmount(intRowCount);

						break;					
						// END: Trada 23-02-2006

				}
			}
			catch(PCSException ex)
			{
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
			catch(Exception ex)
			{
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
		}

		private void dgrdData_BeforeColUpdate(object sender, BeforeColUpdateEventArgs e)
		{
			const string METHOD_NAME = THIS + ".dgrdData_BeforeColUpdate()";

			try
			{				
				//if(e.Column.DataColumn.Text.Trim().Length == 0) return;
				e.Cancel = !ProcessInputDataInGrid(e.Column.DataColumn.DataField, e.Column.DataColumn.Value.ToString().Trim(), false);				
			}
			catch(PCSException ex)
			{
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
			catch(Exception ex)
			{
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
		}		

		private void dgrdData_ButtonClick(object sender, ColEventArgs e)
		{
			const string METHOD_NAME = THIS + ".dgrdData_ButtonClick()";

			try
			{					
				ProcessInputDataInGrid(e.Column.DataColumn.DataField, e.Column.DataColumn.Value.ToString().Trim(), true);
			}
			catch(PCSException ex)
			{
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
			catch(Exception ex)
			{
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
		}
		
		private void dgrdData_BeforeColEdit(object sender, BeforeColEditEventArgs e)
		{
			const string METHOD_NAME = THIS + ".dgrdData_BeforeColEdit()";
			try
			{				
				intCurrentRow = dgrdData.Row;
				// check QAStatus
				if (e.Column.DataColumn.DataField == PO_InvoiceDetailTable.QASTATUS_FLD)
				{
					int intQAStatus = 0;
					try
					{
						intQAStatus = Convert.ToInt32(dgrdData[dgrdData.Row, ITM_ProductTable.TABLE_NAME + ITM_ProductTable.QASTATUS_FLD]);
					}
					catch{}
					// not require inspection, cancel action
					if (intQAStatus == (int)EnumQA.NOT_REQUIRE_INSPECTION)
						e.Cancel = true;
				}
			}
			catch(Exception ex)
			{
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
		}
		
		private void dgrdData_AfterDelete(object sender, EventArgs e)
		{
			const string METHOD_NAME = THIS + ".dgrdData_AfterDelete()";

			try
			{	
				//Get actual number of rows 
				int intRowCount = GetActualRowCount(dtbDetail);
				//Update total values
				CalculateTotalBeforeVATAmount(intRowCount);
				CalculateTotalCIFAmount(intRowCount);
				CalculateTotalCIPAmount(intRowCount);
				CalculateTotalInlandAmount(intRowCount);
				CalculateTotalImportAmount(intRowCount);
				CalculateTotalVATAmount(intRowCount);				
			}
			catch(Exception ex)
			{
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
		}
		
		private void dgrdData_AfterColUpdate(object sender, ColEventArgs e)
		{
			const string METHOD_NAME = THIS + ".dgrdData_ButtonClick()";

			try
			{
				CalculateDataInGrid(e.Column.DataColumn.DataField);
			}
			catch(Exception ex)
			{
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
		}
		
		private void dgrdData_MouseDown(object sender, MouseEventArgs e)
		{
			const string METHOD_NAME = THIS + ".dgrdData_MouseDown()";
			try
			{
				//Check if in Default (Idle) mode
				if(enuFormAction == EnumAction.Default)
				{
					return;
				}
				
				//Check if current row is empty
				if(dgrdData.Columns[PO_PurchaseOrderMasterTable.TABLE_NAME + PO_PurchaseOrderMasterTable.CODE_FLD].Value.Equals(DBNull.Value)
				|| dgrdData.Columns[PO_PurchaseOrderMasterTable.TABLE_NAME + PO_PurchaseOrderMasterTable.CODE_FLD].Text == string.Empty)
				{
					return;
				}

				if(dgrdData.Col == dgrdData.Columns.IndexOf(dgrdData.Columns[PO_InvoiceDetailTable.INLAND_FLD]))
				{
					if(e.Button == MouseButtons.Right)
					{
						PCSInputBoxResult  inputBoxResult = PCSInputBox.Show(lblInputTotalInland.Text, lblInputTotalInland.Text);
						if(inputBoxResult.ReturnCode == DialogResult.OK)
						{
							decimal decTotalInlandAmount = decimal.Parse(inputBoxResult.Value.ToString());
							decimal decTotalCIFAMount = decimal.One;

							if(!numTotalCIFAmount.ValueIsDbNull && numTotalCIFAmount.Text != string.Empty)
							{
								decTotalCIFAMount = Decimal.Parse(numTotalCIFAmount.Value.ToString());

								//except zero value of total CIF amount
								if(decTotalCIFAMount == Decimal.Zero)
								{
									decTotalCIFAMount = Decimal.One;
								}
							}

							//Get actual number of rows 
							int intRowCount = GetActualRowCount(dtbDetail);
							for(int i = 0; i < intRowCount; i++)
							{								
								decimal decCIFAMount = decimal.Zero;
								
								//Inorge blank row
								if(dgrdData[i, PO_PurchaseOrderMasterTable.TABLE_NAME + PO_PurchaseOrderMasterTable.CODE_FLD].Equals(DBNull.Value)
								|| dgrdData[i, PO_PurchaseOrderMasterTable.TABLE_NAME + PO_PurchaseOrderMasterTable.CODE_FLD].ToString().Length == 0)
									continue;

								if(!dgrdData[i, PO_InvoiceDetailTable.CIFAMOUNT_FLD].Equals(DBNull.Value)
									&& !dgrdData[i, PO_InvoiceDetailTable.CIFAMOUNT_FLD].ToString().Equals(string.Empty))
								{
									decCIFAMount = decimal.Parse(dgrdData[i, PO_InvoiceDetailTable.CIFAMOUNT_FLD].ToString());
								}								

								dgrdData[i, PO_InvoiceDetailTable.INLAND_FLD] = (decCIFAMount / decTotalCIFAMount) * decTotalInlandAmount;

								//Update calculate value
								intCurrentRow = i;
								CalculateDataInGrid(PO_InvoiceDetailTable.INLAND_FLD);
							}
						}
					}
				}
			}
			catch(Exception ex)
			{
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
		}		

		#endregion Event Processing				
	
		#region Thachnn: Report Section: add print configuration and add Customs List Report
		/// <summary>
		/// Make btnPrintConfiguration always enable/disable like the btnPrint
		/// </summary>
		/// <param name="sender"></param>
		/// <param name="e"></param>
		private void btnPrint_EnabledChanged(object sender, System.EventArgs e)
		{
			btnPrintConfiguration.Enabled = ((Control)sender).Enabled;
		}



		#region Thachnn : Customs List Report
				
		#region CUSTOMS LIST REPORT variables	
						
		const string REPORT_LAYOUT_FILE = "CustomsList.xml";
		const string REPORT_NAME = "CustomsList";

		const string REPORTFLD_TITLE			= "fldTitle";
		const string REPORTFLD_COMPANY			= "fldCompany";
		const string REPORTFLD_ADDRESS			= "fldAddress";
		const string REPORTFLD_TEL				= "fldTel";
		const string REPORTFLD_FAX				= "fldFax";

		const string REPORTFLD_HOA_DON_SO					= "fldParameterHoaDonSo";
		const string REPORTFLD_TY_GIA					= "fldParameterCurrencyCode";		
        	
		UtilsBO boUtil = new UtilsBO();
		#endregion

		/// <summary>
		/// <author>thachnn</author>
		/// <date>08/06/2006</date>
		/// Print the Customs List Report
		/// Using the "CustomsList.xml" layout
		/// </summary>		
		private void ShowCustomsList(object sender, System.EventArgs e)
		{			
			const string METHOD_NAME = THIS + "ShowCustomsList() event handler";		
			Cursor = Cursors.WaitCursor;

			try	// function starting
			{						
				//return if no record was selected
				if(voMaster.InvoiceMasterID <= 0)
				{
					Cursor = Cursors.Default;
					return;
				}

				string strInvoiceNo = txtInvoiceNo.Text;			// YY
				string strCurrencyCode = txtCurrency.Text;	// XX			

				int nCCNID = int.MinValue;
				int nInvoiceMasterID = int.MinValue;
				int nMonth = DateTime.MinValue.Month; //minimum month
				int nYear = DateTime.MinValue.Year; // Minimum year			

				#region PREPARE			

				string mstrReportDefFolder = Application.StartupPath + "\\" +Constants.REPORT_DEFINITION_STORE_LOCATION;
				DataTable dtbResult;
				DataTable dtbCheckVAT;
				DataTable dtbCheckImportTAX;
				
				PCSComUtils.Framework.ReportFrame.BO.C1PrintPreviewDialogBO objBO = new PCSComUtils.Framework.ReportFrame.BO.C1PrintPreviewDialogBO();			
		
				// check report layout file is exist or not
				if (!System.IO.File.Exists(mstrReportDefFolder + @"\" + REPORT_LAYOUT_FILE))
				{
					PCSMessageBox.Show(ErrorCode.MESSAGE_REPORT_TEMPLATE_FILE_NOT_FOUND, MessageBoxIcon.Error);
					Cursor = Cursors.Default;
					return;
				}
				#endregion

				nCCNID = int.Parse(cboCCN.SelectedValue.ToString());
				nInvoiceMasterID = voMaster.InvoiceMasterID;	

				#region BUILDING THE TABLE (getting from database by BO)
				C1PrintPreviewDialogBO boDataReport = new C1PrintPreviewDialogBO();
				DataSet dstResult = boDataReport.GetCustomsListReportData(nCCNID,  nInvoiceMasterID);
				dtbResult = dstResult.Tables[0];
				dtbCheckVAT = dstResult.Tables[1];
				dtbCheckImportTAX = dstResult.Tables[2];
				#endregion
		
				#region Validate data
		
				// user must select CCN first
				if (cboCCN.SelectedValue == null || cboCCN.SelectedValue == DBNull.Value)
				{
					string[] arrParams = {lblCCN.Text};
					PCSMessageBox.Show(ErrorCode.MESSAGE_MANDATORY_FIELD_REQUIRED, MessageBoxIcon.Error,arrParams);
					cboCCN.Focus();
					Cursor = Cursors.Default;
					return;
				}
				// Check if user does not select Invoice
				if(txtInvoiceNo.Text.Trim() == string.Empty)
				{
					string[] arrParams = {lblInvoiceNo.Text};
					PCSMessageBox.Show(ErrorCode.MESSAGE_MANDATORY_FIELD_REQUIRED, MessageBoxIcon.Error,arrParams);
					txtInvoiceNo.Focus();
					Cursor = Cursors.Default;
					return;
				}

				foreach(DataRow drow in dtbCheckVAT.Rows)
				{
					string[] arrParams = {lblVATTaxRate.Text};
					PCSMessageBox.Show(ErrorCode.MESSAGE_PRODUCT_WITH_MULTIPLE_TAXRATE_IN_INVOICE, MessageBoxIcon.Error,arrParams);
//					txtInvoiceNo.Focus();
					Cursor = Cursors.Default;
					return;					
				}
				foreach(DataRow drow in dtbCheckImportTAX.Rows)
				{
					string[] arrParams = {lblImportTaxRate.Text};
						PCSMessageBox.Show(ErrorCode.MESSAGE_PRODUCT_WITH_MULTIPLE_TAXRATE_IN_INVOICE, MessageBoxIcon.Error,arrParams);
//					txtInvoiceNo.Focus();					
					Cursor = Cursors.Default;
					return;					
				}


				#endregion			 Validate data	

			
				#region RENDER REPORT
		
				ReportBuilder objRB;	
				objRB = new ReportBuilder();
				objRB.ReportName = REPORT_NAME;
				objRB.SourceDataTable = dtbResult;

				#region INIT REPORT BUIDER OBJECT
				try
				{
					objRB.ReportDefinitionFolder = mstrReportDefFolder;
					objRB.ReportLayoutFile = REPORT_LAYOUT_FILE;					
					if(objRB.AnalyseLayoutFile() == false)
					{
						PCSMessageBox.Show(ErrorCode.MESSAGE_REPORT_TEMPLATE_FILE_NOT_FOUND, MessageBoxIcon.Error);
						return;
					}
					//objRB.UseLayoutFile = objRB.AnalyseLayoutFile();	// use layout file if any , auto drawing if not found layout file
					objRB.UseLayoutFile = true;	// always use layout file
				}
				catch
				{
					objRB.UseLayoutFile = false;
					PCSMessageBox.Show(ErrorCode.MESSAGE_REPORT_TEMPLATE_FILE_NOT_FOUND,MessageBoxIcon.Error);
				}
				#endregion				

				objRB.MakeDataTableForRender();

				// and show it in preview dialog				
				PCSUtils.Framework.ReportFrame.C1PrintPreviewDialog	printPreview = new PCSUtils.Framework.ReportFrame.C1PrintPreviewDialog();

				objRB.ReportViewer = printPreview.ReportViewer;
				objRB.RenderReport();

				#region MODIFY THE REPORT LAYOUT				
				objRB.DrawPredefinedField(REPORTFLD_TY_GIA, strCurrencyCode );
				objRB.DrawPredefinedField(REPORTFLD_HOA_DON_SO, strInvoiceNo );				

				#region COMPANY INFO // header information get from system params
				try
				{
					objRB.DrawPredefinedField(REPORTFLD_COMPANY,SystemProperty.SytemParams.Get(SystemParam.COMPANY_NAME));
				}
				catch{}
				try
				{
					objRB.DrawPredefinedField(REPORTFLD_ADDRESS,SystemProperty.SytemParams.Get(SystemParam.ADDRESS));					
				}
				catch{}
				try
				{
					objRB.DrawPredefinedField(REPORTFLD_TEL,SystemProperty.SytemParams.Get(SystemParam.TEL));					
				}
				catch{}
				try
				{
					objRB.DrawPredefinedField(REPORTFLD_FAX,SystemProperty.SytemParams.Get(SystemParam.FAX));					
				}
				catch{}
				#endregion
			
				#endregion						
				objRB.RefreshReport();
				
				/// force the copies number
				printPreview.ReportViewer.PreviewPane.PrinterSettings.Copies = (short)((ReportMenuItem)sender).PrintConfigurationVO.Copies;
				printPreview.FormTitle = objRB.GetFieldByName(REPORTFLD_TITLE).Text ;
				Cursor = Cursors.Default;
				printPreview.Show();
				#endregion

			}
			catch(Exception ex)
			{
				//DEBUG: PCSMessageBox.Show(ErrorCode.MESSAGE_RENVIEW_REPORT,MessageBoxIcon.Error);
				//
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR);
				// log message.
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
			finally
			{
				Cursor = Cursors.Default;				
			}			
		}


	
		#endregion Thachnn: Customs List report

		private void dgrdData_BeforeDelete(object sender, C1.Win.C1TrueDBGrid.CancelEventArgs e)
		{
			if(dgrdData[dgrdData.Row, PO_InvoiceDetailTable.INVOICEDETAILID_FLD] != DBNull.Value)
			{
				//Check if Invoice has been receipt
				POInvoiceBO boPOInvoice = new POInvoiceBO();
				if (boPOInvoice.CheckIfInvoiceHasBeenReceipt(int.Parse(dgrdData[dgrdData.Row, PO_InvoiceDetailTable.INVOICEDETAILID_FLD].ToString())))
				{
					e.Cancel = true;
				}
			}
		}

		#endregion Thachnn: Report Section: add print configuration and add Customs List Report

		private void btnCheckQA_Click(object sender, System.EventArgs e)
		{
			const string METHOD_NAME = THIS + ".btnCheckQA_Click()";
			try
			{
				enuFormAction = EnumAction.Edit;
				LockControl(true);
				btnInvoiceNo.Enabled = false;
				txtInvoiceNo.Enabled = false;
				btnAdd.Enabled = false;
				btnSave.Enabled = true;
				btnEdit.Enabled = false;
				btnPrint.Enabled = false;
				btnCheckQA.Enabled = false;
				dgrdData.AllowUpdate = true;
				foreach (C1DisplayColumn c1Col in dgrdData.Splits[0].DisplayColumns)
				{
					c1Col.Locked = true;
					c1Col.Button = false;
				}
				dgrdData.Splits[0].DisplayColumns[PO_InvoiceDetailTable.QASTATUS_FLD].Locked = false;
				dgrdData.Splits[0].DisplayColumns[PO_InvoiceDetailTable.QASTATUS_FLD].Button = true;

				dgrdData.Splits[0].DisplayColumns[PO_InvoiceDetailTable.NGQUANTITY_FLD].Locked = false;

				dgrdData.Row = 0;
				dgrdData.Col = dgrdData.Columns.IndexOf(dgrdData.Columns[PO_InvoiceDetailTable.QASTATUS_FLD]);
				dgrdData.Focus();
				
				// enable save button
				btnSave.Enabled = true;
			}
			catch(PCSException ex)
			{
				PCSMessageBox.Show(ex.mCode, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex.CauseException, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
			catch(Exception ex)
			{
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
		}

		private void dgrdData_RowColChange(object sender, C1.Win.C1TrueDBGrid.RowColChangeEventArgs e)
		{
			const string METHOD_NAME = THIS + ".dgrdData_RowColChange()";
			try
			{				
				int intQAStatus = 0;
				try
				{
					intQAStatus = Convert.ToInt32(dgrdData[dgrdData.Row, ITM_ProductTable.TABLE_NAME + ITM_ProductTable.QASTATUS_FLD]);
				}
				catch{}
				// not require inspection, disable qa status
				if (intQAStatus == (int)EnumQA.NOT_REQUIRE_INSPECTION)
				{
					dgrdData.Splits[0].DisplayColumns[PO_InvoiceDetailTable.QASTATUS_FLD].Locked = true;
				}
				else
				{
					dgrdData.Splits[0].DisplayColumns[PO_InvoiceDetailTable.QASTATUS_FLD].Locked = false;
				}
			}
			catch(Exception ex)
			{
				PCSMessageBox.Show(ErrorCode.OTHER_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error);
				try
				{
					Logger.LogMessage(ex, METHOD_NAME, Level.ERROR);
				}
				catch
				{
					PCSMessageBox.Show(ErrorCode.LOG_EXCEPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
		}

        private void btnPrint_Click(object sender, EventArgs e)
        {

        }
	}
}